Bugfix. Automatic anonymous login didn't work if keepalive=false.
This commit is contained in:
parent
6260ba2864
commit
9db289df86
72
converse.js
72
converse.js
@ -5517,49 +5517,49 @@
|
|||||||
this.setUpXMLLogging();
|
this.setUpXMLLogging();
|
||||||
|
|
||||||
if (this.keepalive) {
|
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');
|
rid = this.session.get('rid');
|
||||||
sid = this.session.get('sid');
|
sid = this.session.get('sid');
|
||||||
jid = this.session.get('jid');
|
jid = this.session.get('jid');
|
||||||
if (this.authentication === "prebind") {
|
}
|
||||||
if (!this.jid) {
|
if (this.authentication === PREBIND) {
|
||||||
throw new Error("initConnection: when using 'keepalive' with 'prebind, you must supply the JID of the current user.");
|
if (!this.keepalive) {
|
||||||
}
|
if (this.jid && this.sid && this.rid) {
|
||||||
if (rid && sid && jid && Strophe.getBareJidFromJid(jid) === Strophe.getBareJidFromJid(this.jid)) {
|
this.connection.attach(this.jid, this.sid, this.rid, this.onConnStatusChanged);
|
||||||
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.prebind_url) {
|
|
||||||
this.startNewBOSHSession();
|
|
||||||
} else {
|
} else {
|
||||||
delete this.connection;
|
throw new Error("initConnection: If you use prebind and not keepalive, "+
|
||||||
this.emit('noResumeableSession');
|
"then you MUST supply JID, RID and SID values");
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Non-prebind case.
|
|
||||||
if (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) {
|
|
||||||
if (!this.jid) {
|
|
||||||
throw new Error("initConnection: If you use auto_login, you also need to provide a jid value");
|
|
||||||
}
|
|
||||||
if (this.authentication === ANONYMOUS) {
|
|
||||||
this.connection.connect(this.jid, null, this.onConnStatusChanged);
|
|
||||||
} else if (this.authentication === LOGIN) {
|
|
||||||
if (!this.password) {
|
|
||||||
throw new Error("initConnection: If you use auto_login and "+
|
|
||||||
"authentication='login' then you also need to provide a password.");
|
|
||||||
}
|
|
||||||
this.connection.connect(this.jid, this.password, this.onConnStatusChanged);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (this.authentication == "prebind") {
|
if (rid && sid && jid && Strophe.getBareJidFromJid(jid) === Strophe.getBareJidFromJid(this.jid)) {
|
||||||
// prebind is used without keepalive
|
this.session.save({rid: rid}); // The RID needs to be increased with each request.
|
||||||
if (this.jid && this.sid && this.rid) {
|
this.connection.attach(jid, sid, rid, this.onConnStatusChanged);
|
||||||
this.connection.attach(this.jid, this.sid, this.rid, this.onConnStatusChanged);
|
} else if (this.prebind_url) {
|
||||||
|
this.startNewBOSHSession();
|
||||||
} else {
|
} else {
|
||||||
throw new Error("initConnection: If you use prebind and not keepalive, "+
|
delete this.connection;
|
||||||
"then you MUST supply JID, RID and SID values");
|
this.emit('noResumeableSession');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Non-prebind case.
|
||||||
|
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) {
|
||||||
|
if (!this.jid) {
|
||||||
|
throw new Error("initConnection: If you use auto_login, you also need to provide a jid value");
|
||||||
|
}
|
||||||
|
if (this.authentication === ANONYMOUS) {
|
||||||
|
this.connection.connect(this.jid, null, this.onConnStatusChanged);
|
||||||
|
} else if (this.authentication === LOGIN) {
|
||||||
|
if (!this.password) {
|
||||||
|
throw new Error("initConnection: If you use auto_login and "+
|
||||||
|
"authentication='login' then you also need to provide a password.");
|
||||||
|
}
|
||||||
|
this.connection.connect(this.jid, this.password, this.onConnStatusChanged);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user