| author | Eric Roberts
<eric@devl.me> 2026-10-01 20:15:49 UTC |
| committer | Stephen Paul Weber
<singpolyma@singpolyma.net> 2026-10-02 00:26:36 UTC |
| parent | 84ea29725ec1f56c779774bd78a7ef31bf3f32f1 |
| borogove/Chat.hx | +16 | -0 |
| borogove/Client.hx | +10 | -0 |
diff --git a/borogove/Chat.hx b/borogove/Chat.hx index 1a4bc8c..68a98a1 100644 --- a/borogove/Chat.hx +++ b/borogove/Chat.hx @@ -1540,6 +1540,10 @@ class Channel extends Chat { @:allow(borogove) private function new(client:Client, stream:GenericStream, persistence:Persistence, chatId:String, uiState = Open, isBookmarked = false, isBlocked = false, extensions = null, readUpToId = null, readUpToBy = null, ?disco: Caps) { super(client, stream, persistence, chatId, uiState, isBookmarked, isBlocked, extensions, readUpToId, readUpToBy); + trace( + "SYNC: channel inSync", + { reason: "initialize", chatId: chatId, inSync: inSync } + ); if (disco != null) { this.disco = disco; if (!disco.features.contains("http://jabber.org/protocol/muc")) { @@ -1604,6 +1608,10 @@ class Channel extends Chat { self = null; outbox.pause(); inSync = false; + trace( + "SYNC: channel inSync", + { reason: "join", chatId: chatId, inSync: inSync } + ); client.trigger("chats/update", [this]); final desiredFullJid = JID.parse(chatId).withResource(client.displayName()); client.sendPresence( @@ -1882,6 +1890,10 @@ class Channel extends Chat { } if (!disco.features.contains("urn:xmpp:mam:2")) { inSync = true; + trace( + "SYNC: channel inSync", + { reason: "MAM unsupported", chatId: chatId, inSync: inSync } + ); return; } if (sync != null) return; @@ -1958,6 +1970,10 @@ class Channel extends Chat { sync.fetchNext(); } else { inSync = true; + trace( + "SYNC: channel inSync", + { reason: "MAM sync complete", chatId: chatId, inSync: inSync } + ); sync = null; final serverIds: Map<String, Bool> = []; diff --git a/borogove/Client.hx b/borogove/Client.hx index bc39a66..9add294 100644 --- a/borogove/Client.hx +++ b/borogove/Client.hx @@ -1102,6 +1102,16 @@ class Client extends EventEmitter { // and will get anything since live for (channel in getChannels()) { channel.inSync = channel.self != null && channel.sortId != null; + trace( + "SYNC: channel inSync", + { + reason: "resume from disk", + chatId: channel.chatId, + inSync: channel.inSync, + isJoined: channel.self != null, + sortId: channel.sortId, + } + ); if (!channel.inSync) channel.join(); } firstSync = false;