From f58d4c941fe3ccb665029a8d45b339aabc4b45e4 Mon Sep 17 00:00:00 2001 From: ansuz Date: Thu, 24 Aug 2017 17:19:57 +0200 Subject: [PATCH] clean up a bit --- www/common/common-messenger.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/common/common-messenger.js b/www/common/common-messenger.js index 804c26290..3117c60c1 100644 --- a/www/common/common-messenger.js +++ b/www/common/common-messenger.js @@ -228,6 +228,7 @@ define([ leave: [], update: [], new_friend: [], + unfriend: [], }, range_requests: {}, }; @@ -371,8 +372,8 @@ define([ // check that the responding peer's encrypted netflux id matches // the sender field. This is to prevent replay attacks. if (parsed[2] !== sender || !parsed[1]) { return; } - channel.mapId[sender] = parsed[1]; // HERE - messenger.handlers.join.forEach(function (f) { + channel.mapId[sender] = parsed[1]; + eachHandler('join', function (f) { f(parsed[1], channel.id); }); @@ -431,7 +432,7 @@ define([ // TODO emit message event channel.messages.push(res); - messenger.handlers.message.forEach(function (f) { + eachHandler('message', function (f) { f(res); }); @@ -693,7 +694,7 @@ define([ } // update status if (!curvePublic) { return; } - messenger.handlers.leave.forEach(function (f) { + eachHandler('leave', function (f) { f(curvePublic, channel.id); }); }); @@ -823,6 +824,7 @@ define([ console.error(o, n, p); }).on('remove', ['friends'], function (o, p) { + // TODO eachHandler('unfriend', function (f) { f(); }); console.error(o, p); });