git » sdk » commit c88790a

Only treat a channel as synced when resume from disk

author Stephen Paul Weber
2026-03-16 15:14:25 UTC
committer Stephen Paul Weber
2026-03-16 15:14:25 UTC
parent 88f0b2fd3ba9be40527f6f6771e5c15b4c438c73

Only treat a channel as synced when resume from disk

borogove/Client.hx +10 -4

diff --git a/borogove/Client.hx b/borogove/Client.hx
index 2e50b6f..64ee6f5 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -113,6 +113,7 @@ class Client extends EventEmitter {
 
 	@:allow(borogove)
 	private var inSync(default, null) = false;
+	private var firstSync = true;
 
 	/**
 		Create a new Client to connect to a particular account
@@ -690,6 +691,7 @@ class Client extends EventEmitter {
 				}
 				return EventHandled;
 			});
+			firstSync = true;
 			stream.connect(jid.asString(), sm);
 		});
 	}
@@ -833,10 +835,14 @@ class Client extends EventEmitter {
 
 		if (data.resumed) {
 			inSync = true;
-			for (chat in getChats()) {
-				final channel = Std.downcast(chat, Channel);
-				if (channel != null) {
-					channel.inSync = true;
+			if (firstSync) {
+				// We resumed from disk so these must have been synced before
+				// and will get anything since live
+				for (chat in getChats()) {
+					final channel = Std.downcast(chat, Channel);
+					if (channel != null) {
+						channel.inSync = true;
+					}
 				}
 			}