Fix friend requests from the userlist
This commit is contained in:
parent
f292407c6e
commit
c18d4297e1
@ -464,6 +464,11 @@ define([
|
|||||||
common.onNetworkDisconnect = Util.mkEvent();
|
common.onNetworkDisconnect = Util.mkEvent();
|
||||||
common.onNetworkReconnect = Util.mkEvent();
|
common.onNetworkReconnect = Util.mkEvent();
|
||||||
|
|
||||||
|
// Messaging
|
||||||
|
var messaging = common.messaging = {};
|
||||||
|
messaging.onFriendRequest = Util.mkEvent();
|
||||||
|
messaging.onFriendComplete = Util.mkEvent();
|
||||||
|
|
||||||
// Messenger
|
// Messenger
|
||||||
var messenger = common.messenger = {};
|
var messenger = common.messenger = {};
|
||||||
messenger.getFriendList = function (cb) {
|
messenger.getFriendList = function (cb) {
|
||||||
@ -600,13 +605,11 @@ define([
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'Q_FRIEND_REQUEST': {
|
case 'Q_FRIEND_REQUEST': {
|
||||||
if (!common.onFriendRequest) { break; }
|
common.messaging.onFriendRequest.fire(data, cb);
|
||||||
common.onFriendRequest(data, cb);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'EV_FRIEND_COMPLETE': {
|
case 'EV_FRIEND_COMPLETE': {
|
||||||
if (!common.onFriendComplete) { break; }
|
common.messaging.onFriendComplete.fire(data);
|
||||||
common.onFriendComplete(data);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Network
|
// Network
|
||||||
|
|||||||
@ -616,11 +616,11 @@ define([
|
|||||||
postMessage("UPDATE_METADATA");
|
postMessage("UPDATE_METADATA");
|
||||||
},
|
},
|
||||||
pinPads: Store.pinPads,
|
pinPads: Store.pinPads,
|
||||||
friendComplete: function (data, cb) {
|
friendComplete: function (data) {
|
||||||
postMessage("Q_FRIEND_COMPLETE", data, cb);
|
postMessage("EV_FRIEND_COMPLETE", data);
|
||||||
},
|
},
|
||||||
friendRequest: function (data) {
|
friendRequest: function (data, cb) {
|
||||||
postMessage("EV_FRIEND_REQUEST", data);
|
postMessage("Q_FRIEND_REQUEST", data, cb);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -307,17 +307,16 @@ define([
|
|||||||
});
|
});
|
||||||
|
|
||||||
sframeChan.on('Q_SEND_FRIEND_REQUEST', function (netfluxId, cb) {
|
sframeChan.on('Q_SEND_FRIEND_REQUEST', function (netfluxId, cb) {
|
||||||
Messaging.inviteFromUserlist(Cryptpad, netfluxId);
|
Cryptpad.inviteFromUserlist(netfluxId, cb);
|
||||||
cb();
|
|
||||||
});
|
});
|
||||||
Cryptpad.onFriendRequest = function (confirmText, cb) {
|
Cryptpad.messaging.onFriendRequest.reg(function (confirmText, cb) {
|
||||||
sframeChan.query('Q_INCOMING_FRIEND_REQUEST', confirmText, function (err, data) {
|
sframeChan.query('Q_INCOMING_FRIEND_REQUEST', confirmText, function (err, data) {
|
||||||
cb(data);
|
cb(data);
|
||||||
});
|
});
|
||||||
};
|
});
|
||||||
Cryptpad.onFriendComplete = function (data) {
|
Cryptpad.messaging.onFriendComplete.reg(function (data) {
|
||||||
sframeChan.event('EV_FRIEND_REQUEST', data);
|
sframeChan.event('EV_FRIEND_REQUEST', data);
|
||||||
};
|
});
|
||||||
|
|
||||||
sframeChan.on('Q_GET_FULL_HISTORY', function (data, cb) {
|
sframeChan.on('Q_GET_FULL_HISTORY', function (data, cb) {
|
||||||
var crypto = Crypto.createEncryptor(secret.keys);
|
var crypto = Crypto.createEncryptor(secret.keys);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user