From fa1dcf6b00ae291849289e41a0c2efab83aa02ce Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Thu, 27 Oct 2016 18:19:42 +0700 Subject: [PATCH] unsubscribe --- adaptor-xmpp.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/adaptor-xmpp.js b/adaptor-xmpp.js index ac1ca81..ed52dd3 100644 --- a/adaptor-xmpp.js +++ b/adaptor-xmpp.js @@ -55,6 +55,10 @@ function onSubscribe(sender) { xmpp.acceptSubscription(sender); } +function onUnsubscribe(sender) { + xmpp.acceptUnsubscription(sender); +} + function onBuddy(jid, state, statusText, resource) { logger.verbose('Buddy state change', {jid: jid, state: state, statusText: statusText, resource: resource}); @@ -106,8 +110,11 @@ function init(_username, _password, _logger, _callbacks) { xmpp.on('chat', onPM); xmpp.on('error', onError); xmpp.on('subscribe', onSubscribe); + xmpp.on('unsubscribe', onUnsubscribe); xmpp.on('buddy', onBuddy); + xmpp.unsubscribe(); + xmpp.connect({ jid: username, password: password -- 1.9.0