|
@@ -288,13 +288,13 @@ converse.plugins.add('converse-roster', {
|
|
|
|
|
|
ackUnsubscribe () {
|
|
ackUnsubscribe () {
|
|
/* Upon receiving the presence stanza of type "unsubscribed",
|
|
/* Upon receiving the presence stanza of type "unsubscribed",
|
|
- * the user SHOULD acknowledge receipt of that subscription state
|
|
|
|
- * notification by sending a presence stanza of type "unsubscribe"
|
|
|
|
- * this step lets the user's server know that it MUST no longer
|
|
|
|
- * send notification of the subscription state change to the user.
|
|
|
|
- * Parameters:
|
|
|
|
- * (String) jid - The Jabber ID of the user who is unsubscribing
|
|
|
|
- */
|
|
|
|
|
|
+ * the user SHOULD acknowledge receipt of that subscription state
|
|
|
|
+ * notification by sending a presence stanza of type "unsubscribe"
|
|
|
|
+ * this step lets the user's server know that it MUST no longer
|
|
|
|
+ * send notification of the subscription state change to the user.
|
|
|
|
+ * Parameters:
|
|
|
|
+ * (String) jid - The Jabber ID of the user who is unsubscribing
|
|
|
|
+ */
|
|
_converse.api.send($pres({'type': 'unsubscribe', 'to': this.get('jid')}));
|
|
_converse.api.send($pres({'type': 'unsubscribe', 'to': this.get('jid')}));
|
|
this.removeFromRoster();
|
|
this.removeFromRoster();
|
|
this.destroy();
|
|
this.destroy();
|
|
@@ -311,9 +311,9 @@ converse.plugins.add('converse-roster', {
|
|
|
|
|
|
authorize (message) {
|
|
authorize (message) {
|
|
/* Authorize presence subscription
|
|
/* Authorize presence subscription
|
|
- * Parameters:
|
|
|
|
- * (String) message - Optional message to send to the person being authorized
|
|
|
|
- */
|
|
|
|
|
|
+ * Parameters:
|
|
|
|
+ * (String) message - Optional message to send to the person being authorized
|
|
|
|
+ */
|
|
const pres = $pres({'to': this.get('jid'), 'type': "subscribed"});
|
|
const pres = $pres({'to': this.get('jid'), 'type': "subscribed"});
|
|
if (message && message !== "") {
|
|
if (message && message !== "") {
|
|
pres.c("status").t(message);
|
|
pres.c("status").t(message);
|
|
@@ -322,16 +322,15 @@ converse.plugins.add('converse-roster', {
|
|
return this;
|
|
return this;
|
|
},
|
|
},
|
|
|
|
|
|
- removeFromRoster (callback, errback) {
|
|
|
|
|
|
+ removeFromRoster () {
|
|
/* Instruct the XMPP server to remove this contact from our roster
|
|
/* Instruct the XMPP server to remove this contact from our roster
|
|
- * Parameters:
|
|
|
|
- * (Function) callback
|
|
|
|
- */
|
|
|
|
|
|
+ * Parameters:
|
|
|
|
+ * (Function) callback
|
|
|
|
+ */
|
|
const iq = $iq({type: 'set'})
|
|
const iq = $iq({type: 'set'})
|
|
.c('query', {xmlns: Strophe.NS.ROSTER})
|
|
.c('query', {xmlns: Strophe.NS.ROSTER})
|
|
.c('item', {jid: this.get('jid'), subscription: "remove"});
|
|
.c('item', {jid: this.get('jid'), subscription: "remove"});
|
|
- _converse.api.sendIQ(iq).then(callback).catch(errback);
|
|
|
|
- return this;
|
|
|
|
|
|
+ return _converse.api.sendIQ(iq);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|
|
@@ -365,7 +364,7 @@ converse.plugins.add('converse-roster', {
|
|
/* Register a handler for roster IQ "set" stanzas, which update
|
|
/* Register a handler for roster IQ "set" stanzas, which update
|
|
* roster contacts.
|
|
* roster contacts.
|
|
*/
|
|
*/
|
|
- _converse.connection.addHandler((iq) => {
|
|
|
|
|
|
+ _converse.connection.addHandler(iq => {
|
|
_converse.roster.onRosterPush(iq);
|
|
_converse.roster.onRosterPush(iq);
|
|
return true;
|
|
return true;
|
|
}, Strophe.NS.ROSTER, 'iq', "set");
|
|
}, Strophe.NS.ROSTER, 'iq', "set");
|
|
@@ -470,7 +469,7 @@ converse.plugins.add('converse-roster', {
|
|
.c('query', {'xmlns': Strophe.NS.ROSTER})
|
|
.c('query', {'xmlns': Strophe.NS.ROSTER})
|
|
.c('item', { jid, name });
|
|
.c('item', { jid, name });
|
|
_.each(groups, group => iq.c('group').t(group).up());
|
|
_.each(groups, group => iq.c('group').t(group).up());
|
|
- _converse.api.sendIQ(iq);
|
|
|
|
|
|
+ return _converse.api.sendIQ(iq);
|
|
},
|
|
},
|
|
|
|
|
|
async addContactToRoster (jid, name, groups, attributes) {
|
|
async addContactToRoster (jid, name, groups, attributes) {
|