From 288e141c1fa7b53a435d7fac177690221c546e93 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 23 Oct 2017 12:33:50 +0200 Subject: [PATCH] add missing sframe method --- www/common/sframe-common-outer.js | 8 ++++++++ www/common/sframe-messenger-inner.js | 5 +++++ www/common/sframe-protocol.js | 1 + www/contacts/messenger-ui.js | 4 ++-- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/www/common/sframe-common-outer.js b/www/common/sframe-common-outer.js index aa10bc29c..e1ca45c3c 100644 --- a/www/common/sframe-common-outer.js +++ b/www/common/sframe-common-outer.js @@ -468,6 +468,14 @@ define([ }); }); }); + sframeChan.on('Q_CONTACTS_REMOVE_FRIEND', function (curvePublic, cb) { + messenger.removeFriend(curvePublic, function (e, info) { + cb({ + error: e, + data: info, + }); + }); + }); sframeChan.on('Q_CONTACTS_OPEN_FRIEND_CHANNEL', function (curvePublic, cb) { messenger.openFriendChannel(curvePublic, function (e) { diff --git a/www/common/sframe-messenger-inner.js b/www/common/sframe-messenger-inner.js index c0dced050..9f2ed24a4 100644 --- a/www/common/sframe-messenger-inner.js +++ b/www/common/sframe-messenger-inner.js @@ -66,6 +66,11 @@ define([], function () { //cb({ error: err, data: data, }); }); }; + messenger.removeFriend = function (curvePublic, cb) { + sFrameChan.query('Q_CONTACTS_REMOVE_FRIEND', curvePublic, function (err, data) { + cb(err || data.error, data.data); + }); + }; messenger.openFriendChannel = function (curvePublic, cb) { sFrameChan.query('Q_CONTACTS_OPEN_FRIEND_CHANNEL', curvePublic, function (err, data) { cb(err || data.error); diff --git a/www/common/sframe-protocol.js b/www/common/sframe-protocol.js index 34655fcd6..d568592ed 100644 --- a/www/common/sframe-protocol.js +++ b/www/common/sframe-protocol.js @@ -148,6 +148,7 @@ define({ 'Q_CONTACTS_GET_FRIEND_LIST': true, 'Q_CONTACTS_GET_MY_INFO': true, 'Q_CONTACTS_GET_FRIEND_INFO': true, + 'Q_CONTACTS_REMOVE_FRIEND': true, 'Q_CONTACTS_OPEN_FRIEND_CHANNEL': true, 'Q_CONTACTS_GET_STATUS': true, 'Q_CONTACTS_GET_MORE_HISTORY': true, diff --git a/www/contacts/messenger-ui.js b/www/contacts/messenger-ui.js index 93de3a21f..fddad4497 100644 --- a/www/contacts/messenger-ui.js +++ b/www/contacts/messenger-ui.js @@ -318,10 +318,10 @@ define([ }; var removeFriend = function (curvePublic) { - messenger.removeFriend(curvePublic, function (e, removed) { + messenger.removeFriend(curvePublic, function (e /*, removed */) { if (e) { return void console.error(e); } find.inList(curvePublic).remove(); - console.log(removed); + //console.log(removed); }); };