|
|
@ -564,7 +564,8 @@ define([
|
|
|
|
onDirectMessage(msg, sender);
|
|
|
|
onDirectMessage(msg, sender);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
var removeFriend = function (curvePublic, cb) {
|
|
|
|
var removeFriend = function (curvePublic, _cb) {
|
|
|
|
|
|
|
|
var cb = Util.once(_cb);
|
|
|
|
if (typeof(cb) !== 'function') { throw new Error('NO_CALLBACK'); }
|
|
|
|
if (typeof(cb) !== 'function') { throw new Error('NO_CALLBACK'); }
|
|
|
|
var data = getFriend(proxy, curvePublic);
|
|
|
|
var data = getFriend(proxy, curvePublic);
|
|
|
|
|
|
|
|
|
|
|
@ -590,7 +591,17 @@ define([
|
|
|
|
var cryptMsg = channel.encrypt(msgStr);
|
|
|
|
var cryptMsg = channel.encrypt(msgStr);
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
channel.wc.bcast(cryptMsg).then(function () {
|
|
|
|
if (store.mailbox && data.curvePublic && data.notifications) {
|
|
|
|
|
|
|
|
store.mailbox.sendTo('UNFRIEND', {
|
|
|
|
|
|
|
|
curvePublic: proxy.curvePublic
|
|
|
|
|
|
|
|
}, {
|
|
|
|
|
|
|
|
channel: data.notifications,
|
|
|
|
|
|
|
|
curvePublic: data.curvePublic
|
|
|
|
|
|
|
|
}, function (obj) {
|
|
|
|
|
|
|
|
console.log(obj);
|
|
|
|
|
|
|
|
if (obj && obj.error) {
|
|
|
|
|
|
|
|
return void cb(obj);
|
|
|
|
|
|
|
|
}
|
|
|
|
removeFromFriendList(curvePublic, function () {
|
|
|
|
removeFromFriendList(curvePublic, function () {
|
|
|
|
delete channels[channel.id];
|
|
|
|
delete channels[channel.id];
|
|
|
|
emit('UNFRIEND', {
|
|
|
|
emit('UNFRIEND', {
|
|
|
@ -599,9 +610,10 @@ define([
|
|
|
|
});
|
|
|
|
});
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}, function (err) {
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
channel.wc.bcast(cryptMsg).then(function () {}, function (err) {
|
|
|
|
console.error(err);
|
|
|
|
console.error(err);
|
|
|
|
cb({error: err});
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
} catch (e) {
|
|
|
|
cb({error: e});
|
|
|
|
cb({error: e});
|
|
|
|