Unfriend via mailbox

This commit is contained in:
yflory
2019-05-27 18:58:35 +02:00
parent 9c4f9378ab
commit 9d8433d104
2 changed files with 32 additions and 10 deletions

View File

@@ -132,6 +132,16 @@ define([
}
};
handlers['UNFRIEND'] = function (ctx, box, data, cb) {
var curve = data.msg.content.curvePublic;
var friend = Messaging.getFriend(ctx.store.proxy, curve);
if (!friend) { return void cb(true); }
delete ctx.store.proxy.friends[curve];
if (ctx.store.messenger) {
ctx.store.messenger.onFriendRemoved(curve, friend.channel);
}
cb(true);
};
return {
add: function (ctx, box, data, cb) {