Bugfix. Automatic anonymous login didn't work if keepalive=false.
This commit is contained in:
parent
6260ba2864
commit
9db289df86
26
converse.js
26
converse.js
@ -5517,12 +5517,21 @@
|
||||
this.setUpXMLLogging();
|
||||
|
||||
if (this.keepalive) {
|
||||
if (!this.jid) {
|
||||
throw new Error("initConnection: when using 'keepalive' with 'prebind, you must supply the JID of the current user.");
|
||||
}
|
||||
rid = this.session.get('rid');
|
||||
sid = this.session.get('sid');
|
||||
jid = this.session.get('jid');
|
||||
if (this.authentication === "prebind") {
|
||||
if (!this.jid) {
|
||||
throw new Error("initConnection: when using 'keepalive' with 'prebind, you must supply the JID of the current user.");
|
||||
}
|
||||
if (this.authentication === PREBIND) {
|
||||
if (!this.keepalive) {
|
||||
if (this.jid && this.sid && this.rid) {
|
||||
this.connection.attach(this.jid, this.sid, this.rid, this.onConnStatusChanged);
|
||||
} else {
|
||||
throw new Error("initConnection: If you use prebind and not keepalive, "+
|
||||
"then you MUST supply JID, RID and SID values");
|
||||
}
|
||||
}
|
||||
if (rid && sid && jid && Strophe.getBareJidFromJid(jid) === Strophe.getBareJidFromJid(this.jid)) {
|
||||
this.session.save({rid: rid}); // The RID needs to be increased with each request.
|
||||
@ -5535,7 +5544,7 @@
|
||||
}
|
||||
} else {
|
||||
// Non-prebind case.
|
||||
if (rid && sid && jid) {
|
||||
if (this.keepalive && rid && sid && jid) {
|
||||
this.session.save({rid: rid}); // The RID needs to be increased with each request.
|
||||
this.connection.attach(jid, sid, rid, this.onConnStatusChanged);
|
||||
} else if (this.auto_login) {
|
||||
@ -5553,15 +5562,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (this.authentication == "prebind") {
|
||||
// prebind is used without keepalive
|
||||
if (this.jid && this.sid && this.rid) {
|
||||
this.connection.attach(this.jid, this.sid, this.rid, this.onConnStatusChanged);
|
||||
} else {
|
||||
throw new Error("initConnection: If you use prebind and not keepalive, "+
|
||||
"then you MUST supply JID, RID and SID values");
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user