Commit 34eb8cdf authored by JC Brand's avatar JC Brand

Add `getDefaultNickname` method

so that plugins can have a different mechanism for determining the default
nick.
parent 462a43b8
...@@ -725,6 +725,15 @@ ...@@ -725,6 +725,15 @@
} }
}, },
getDefaultNickName: function () {
/* The default nickname (used when muc_nickname_from_jid is true)
* is the node part of the user's JID.
* We put this in a separate method so that it can be
* overridden by plugins.
*/
return Strophe.unescapeNode(Strophe.getNodeFromJid(converse.bare_jid));
},
onNicknameClash: function (presence) { onNicknameClash: function (presence) {
/* When the nickname is already taken, we either render a /* When the nickname is already taken, we either render a
* form for the user to choose a new nickname, or we * form for the user to choose a new nickname, or we
...@@ -736,7 +745,7 @@ ...@@ -736,7 +745,7 @@
*/ */
if (converse.muc_nickname_from_jid) { if (converse.muc_nickname_from_jid) {
var nick = presence.getAttribute('from').split('/')[1]; var nick = presence.getAttribute('from').split('/')[1];
if (nick === Strophe.unescapeNode(Strophe.getNodeFromJid(converse.bare_jid))) { if (nick === this.getDefaultNickName()) {
this.join(nick + '-2'); this.join(nick + '-2');
} else { } else {
var del= nick.lastIndexOf("-"); var del= nick.lastIndexOf("-");
......
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