Merge pull request #592 from davec82/master
add random resource also for auto_login
This commit is contained in:
commit
d66ea2079f
@ -13,6 +13,7 @@
|
||||
- #573 xgettext build error: `'javascript' unknown` [jcbrand]
|
||||
- #587 Fix issue when logging out with `auto_logout=true` [davec82]
|
||||
- #589 Save scroll position on minimize and restore it on maximize [rlanvin]
|
||||
- #592 Add random resource for auto_login, add method generateResource to generate random resource [davec82]
|
||||
|
||||
## 0.10.1 (2016-02-06)
|
||||
|
||||
|
@ -415,6 +415,10 @@
|
||||
// Module-level functions
|
||||
// ----------------------
|
||||
|
||||
this.generateResource = function () {
|
||||
return '/converse.js-' + Math.floor(Math.random()*139749825).toString();
|
||||
};
|
||||
|
||||
this.sendCSI = function (stat) {
|
||||
/* Send out a Chat Status Notification (XEP-0352) */
|
||||
if (converse.features[Strophe.NS.CSI] || true) {
|
||||
@ -4723,9 +4727,9 @@
|
||||
if (jid) {
|
||||
resource = Strophe.getResourceFromJid(jid);
|
||||
if (!resource) {
|
||||
jid = jid.toLowerCase() + '/converse.js-' + Math.floor(Math.random()*139749825).toString();
|
||||
jid = jid.toLowerCase() + converse.generateResource();
|
||||
} else {
|
||||
jid = Strophe.getBareJidFromJid(jid).toLowerCase()+'/'+Strophe.getResourceFromJid(jid);
|
||||
jid = Strophe.getBareJidFromJid(jid).toLowerCase()+'/'+resource;
|
||||
}
|
||||
}
|
||||
converse.connection.connect(jid, password, converse.onConnectStatusChanged);
|
||||
@ -4893,7 +4897,12 @@
|
||||
throw new Error("initConnection: If you use auto_login and "+
|
||||
"authentication='login' then you also need to provide a password.");
|
||||
}
|
||||
this.jid = Strophe.getBareJidFromJid(this.jid).toLowerCase()+'/'+Strophe.getResourceFromJid(this.jid);
|
||||
var resource = Strophe.getResourceFromJid(this.jid);
|
||||
if (!resource) {
|
||||
this.jid = this.jid.toLowerCase() + converse.generateResource();
|
||||
} else {
|
||||
this.jid = Strophe.getBareJidFromJid(this.jid).toLowerCase()+'/'+resource;
|
||||
}
|
||||
this.connection.connect(this.jid, this.password, this.onConnectStatusChanged);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user