Commit fa1dcf6b00ae291849289e41a0c2efab83aa02ce

Authored by Adhidarma Hadiwinoto
1 parent e756cfc78d
Exists in master

unsubscribe

Showing 1 changed file with 7 additions and 0 deletions Side-by-side Diff

... ... @@ -55,6 +55,10 @@ function onSubscribe(sender) {
55 55 xmpp.acceptSubscription(sender);
56 56 }
57 57  
  58 +function onUnsubscribe(sender) {
  59 + xmpp.acceptUnsubscription(sender);
  60 +}
  61 +
58 62 function onBuddy(jid, state, statusText, resource) {
59 63 logger.verbose('Buddy state change', {jid: jid, state: state, statusText: statusText, resource: resource});
60 64  
... ... @@ -106,8 +110,11 @@ function init(_username, _password, _logger, _callbacks) {
106 110 xmpp.on('chat', onPM);
107 111 xmpp.on('error', onError);
108 112 xmpp.on('subscribe', onSubscribe);
  113 + xmpp.on('unsubscribe', onUnsubscribe);
109 114 xmpp.on('buddy', onBuddy);
110 115  
  116 + xmpp.unsubscribe();
  117 +
111 118 xmpp.connect({
112 119 jid: username,
113 120 password: password