git » sdk » commit 6110271

Enable carbons after sync

author Stephen Paul Weber
2025-03-04 16:48:58 UTC
committer Stephen Paul Weber
2025-03-04 16:48:58 UTC
parent 1f1798a723047aa2dd9a92e877231e5685106c5c

Enable carbons after sync

Otherwise we start getting some live messages early

snikket/Client.hx +6 -6

diff --git a/snikket/Client.hx b/snikket/Client.hx
index 7166e96..0f9e493 100644
--- a/snikket/Client.hx
+++ b/snikket/Client.hx
@@ -676,12 +676,6 @@ class Client extends EventEmitter {
 			return EventHandled;
 		}
 
-		// Enable carbons
-		sendStanza(
-			new Stanza("iq", { type: "set", id: ID.short() })
-				.tag("enable", { xmlns: "urn:xmpp:carbons:2" })
-				.up()
-		);
 
 		discoverServices(new JID(null, jid.domain), (service, caps) -> {
 			persistence.storeService(accountId(), service.jid.asString(), service.name, service.node, caps);
@@ -715,6 +709,12 @@ class Client extends EventEmitter {
 					this.trigger("chats/update", chats);
 					// Set self to online
 					if (sendAvailable) {
+						// Enable carbons
+						sendStanza(
+							new Stanza("iq", { type: "set", id: ID.short() })
+								.tag("enable", { xmlns: "urn:xmpp:carbons:2" })
+								.up()
+						);
 						sendPresence();
 						pingAllChannels(true);
 					}