Commit 58f6d365 authored by JC Brand's avatar JC Brand

MUC: wait for messages collection to be initialized

before processing MUC messages received prematurely due to SMACKS
resumption.
parent bc48e413
...@@ -2403,9 +2403,13 @@ converse.plugins.add('converse-muc', { ...@@ -2403,9 +2403,13 @@ converse.plugins.add('converse-muc', {
const muc_jid = Strophe.getBareJidFromJid(stanza.getAttribute('from')); const muc_jid = Strophe.getBareJidFromJid(stanza.getAttribute('from'));
if (!_converse.chatboxes.get(muc_jid)) { if (!_converse.chatboxes.get(muc_jid)) {
_converse.api.waitUntil('chatBoxesFetched') _converse.api.waitUntil('chatBoxesFetched')
.then(() => { .then(async () => {
const muc = _converse.chatboxes.get(muc_jid); const muc = _converse.chatboxes.get(muc_jid);
muc && muc.message_handler.run(stanza); if (muc) {
await muc.initialized;
await muc.messages.fetched
muc.message_handler.run(stanza);
}
}); });
} }
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