Commit f3a1351a authored by JC Brand's avatar JC Brand

muc: loosen `isJoined` criteria

Handle any `error` IQ result or timeout from a MUC ping as indication that we're no longer joined.
parent 720087be
...@@ -419,7 +419,7 @@ converse.plugins.add('converse-muc', { ...@@ -419,7 +419,7 @@ converse.plugins.add('converse-muc', {
* @returns { Boolean } Returns `true` if we're still joined, otherwise returns `false`. * @returns { Boolean } Returns `true` if we're still joined, otherwise returns `false`.
*/ */
async restoreFromCache () { async restoreFromCache () {
if (this.session.get('connection_status') === converse.ROOMSTATUS.ENTERED && await this.isJoined()) { if (this.session.get('connection_status') === converse.ROOMSTATUS.ENTERED && (await this.isJoined())) {
// We've restored the room from cache and we're still joined. // We've restored the room from cache and we're still joined.
await new Promise(resolve => this.features.fetch({'success': resolve, 'error': resolve})); await new Promise(resolve => this.features.fetch({'success': resolve, 'error': resolve}));
await this.fetchOccupants(); await this.fetchOccupants();
...@@ -1602,10 +1602,13 @@ converse.plugins.add('converse-muc', { ...@@ -1602,10 +1602,13 @@ converse.plugins.add('converse-muc', {
try { try {
await _converse.api.sendIQ(ping); await _converse.api.sendIQ(ping);
} catch (e) { } catch (e) {
const sel = `error not-acceptable[xmlns="${Strophe.NS.STANZAS}"]`; if (e === null) {
if (isElement(e) && sizzle(sel, e).length) { log.error(`Timeout error while checking whether we're joined to MUC: ${this.get('jid')}`);
return false; } else {
log.error(`Apparently we're no longer connected to MUC: ${this.get('jid')}`);
log.error(e);
} }
return false;
} }
return true; return true;
}, },
......
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