Commit 3a4dfb69 authored by JC Brand's avatar JC Brand

Add support for sending nick along with subscription request

parent cd5615f7
...@@ -98,6 +98,7 @@ Strophe.addConnectionPlugin('roster', ...@@ -98,6 +98,7 @@ Strophe.addConnectionPlugin('roster',
}; };
Strophe.addNamespace('ROSTER_VER', 'urn:xmpp:features:rosterver'); Strophe.addNamespace('ROSTER_VER', 'urn:xmpp:features:rosterver');
Strophe.addNamespace('NICK', 'http://jabber.org/protocol/nick');
}, },
/** Function: supportVersioning /** Function: supportVersioning
* return true if roster versioning is enabled on server * return true if roster versioning is enabled on server
...@@ -183,13 +184,17 @@ Strophe.addConnectionPlugin('roster', ...@@ -183,13 +184,17 @@ Strophe.addConnectionPlugin('roster',
* *
* Parameters: * Parameters:
* (String) jid * (String) jid
* (String) message * (String) message (optional)
* (String) nick (optional)
*/ */
subscribe: function(jid, message) subscribe: function(jid, message, nick) {
{
var pres = $pres({to: jid, type: "subscribe"}); var pres = $pres({to: jid, type: "subscribe"});
if (message && message != "") if (message && message !== "") {
pres.c("status").t(message); pres.c("status").t(message);
}
if (nick && nick !== "") {
pres.c('nick', {'xmlns': Strophe.NS.NICK}).t(nick);
}
this._connection.send(pres); this._connection.send(pres);
}, },
/** Function: unsubscribe /** Function: unsubscribe
...@@ -435,4 +440,4 @@ Strophe.addConnectionPlugin('roster', ...@@ -435,4 +440,4 @@ Strophe.addConnectionPlugin('roster',
item.groups = groups; item.groups = groups;
} }
} }
}); });
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment