Commit 49946158 authored by JC Brand's avatar JC Brand

core: Only throw error when trying keepalive without JID for prebind

parent ea207ad6
...@@ -1894,12 +1894,16 @@ ...@@ -1894,12 +1894,16 @@
xhr.send(); xhr.send();
}; };
this.restoreBOSHSession = function () { this.restoreBOSHSession = function (jid_is_required) {
/* Tries to restore a cached BOSH session. */ /* Tries to restore a cached BOSH session. */
if (!this.jid) { if (!this.jid) {
throw new Error( var msg = "restoreBOSHSession: tried to restore a \"keepalive\" session "+
"restoreBOSHSession: tried to restore a \"keepalive\" session "+ "but we don't have the JID for the user!";
"but we don't have the JID for the user!"); if (jid_is_required) {
throw new Error(msg);
} else {
_converse.log(msg);
}
} }
try { try {
this.connection.restore(this.jid, this.onConnectStatusChanged); this.connection.restore(this.jid, this.onConnectStatusChanged);
...@@ -1918,7 +1922,7 @@ ...@@ -1918,7 +1922,7 @@
* being used. * being used.
*/ */
if (!reconnecting) { if (!reconnecting) {
if (this.keepalive && this.restoreBOSHSession()) { if (this.keepalive && this.restoreBOSHSession(true)) {
return; return;
} }
// No keepalive, or session resumption has failed. // No keepalive, or session resumption has failed.
......
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