Commit f9cc51b2 authored by JC Brand's avatar JC Brand

Bugfix. Make sure that `restoreBOSHSession` is always called

I.e. also when we're reconnecting.

Otherwise the `_converse.bosh_session` object doesn't get recreated and
we don't cache the BOSH tokens.
parent 179c0810
...@@ -498,7 +498,7 @@ function reconnect () { ...@@ -498,7 +498,7 @@ function reconnect () {
_converse.connection.reconnecting = true; _converse.connection.reconnecting = true;
tearDown(); tearDown();
return _converse.api.user.login(null, null, true); return _converse.api.user.login();
} }
const debouncedReconnect = _.debounce(reconnect, 2000); const debouncedReconnect = _.debounce(reconnect, 2000);
...@@ -1488,14 +1488,12 @@ _converse.api = { ...@@ -1488,14 +1488,12 @@ _converse.api = {
* @method _converse.api.user.login * @method _converse.api.user.login
* @param {string} [jid] * @param {string} [jid]
* @param {string} [password] * @param {string} [password]
* @param {boolean} [reconnecting]
*/ */
async login (jid, password, reconnecting) { async login (jid, password) {
if (_converse.api.connection.isType('bosh')) { if (_converse.api.connection.isType('bosh')) {
const uses_prebind = (_converse.authentication === _converse.PREBIND && _converse.prebind_url); if (await _converse.restoreBOSHSession()) {
if (!reconnecting && await _converse.restoreBOSHSession()) {
return; return;
} else if (reconnecting && uses_prebind) { } else if (_converse.authentication === _converse.PREBIND) {
return _converse.startNewBOSHSession(); return _converse.startNewBOSHSession();
} }
} else if (_converse.authentication === _converse.PREBIND) { } else if (_converse.authentication === _converse.PREBIND) {
......
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