Commit 9db289df authored by JC Brand's avatar JC Brand

Bugfix. Automatic anonymous login didn't work if keepalive=false.

parent 6260ba28
......@@ -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");
}
}
}
};
......
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