From 4a681b9483265fbfddabce6695815e98098b9c0f Mon Sep 17 00:00:00 2001 From: "Alexander \"PapaTutuWawa" Date: Sat, 23 Sep 2023 22:19:06 +0200 Subject: [PATCH] fix(xep): Somehow fix reconnection issues --- .../lib/src/xeps/xep_0045/xep_0045.dart | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart b/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart index ba9b281..3d5cdd9 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0045/xep_0045.dart @@ -65,6 +65,7 @@ class MUCManager extends XmppManagerBase { return; } + final mucJoins = List.empty(growable: true); await _cacheLock.synchronized(() async { // Mark all groupchats as not joined. for (final jid in _mucRoomCache.keys) { @@ -72,14 +73,19 @@ class MUCManager extends XmppManagerBase { // Re-join all MUCs. final state = _mucRoomCache[jid]!; - await _sendMucJoin( - jid, - state.nick!, - 0, - ); + mucJoins.add((jid, state.nick!)); } - _joinedPreparedRooms = true; }); + + for (final join in mucJoins) { + final (jid, nick) = join; + await _sendMucJoin( + jid, + nick, + 0, + ); + } + _joinedPreparedRooms = true; } /// Prepares the internal room list to ensure that the rooms