git » sdk » commit 1b44c7b

If it's an error we don't want to process anything

author Stephen Paul Weber
2026-04-13 00:52:07 UTC
committer Stephen Paul Weber
2026-04-13 00:52:07 UTC
parent c8645b99c131d33234f746dec43922f9d83ac3e2

If it's an error we don't want to process anything

borogove/Client.hx +15 -15

diff --git a/borogove/Client.hx b/borogove/Client.hx
index b918e1c..21b0bfa 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -514,6 +514,8 @@ class Client extends EventEmitter {
 				if (newChat != null) this.trigger("chats/update", [newChat]);
 		}
 
+		if (stanza.attr.get("type") == "error") return;
+
 #if !NO_JINGLE
 		final jmiP = stanza.getChild("propose", "urn:xmpp:jingle-message:0");
 		if (jmiP != null && jmiP.attr.get("id") != null) {
@@ -571,21 +573,19 @@ class Client extends EventEmitter {
 		}
 #end
 
-		if (stanza.attr.get("type") != "error") {
-			final chatState = stanza.getChild(null, "http://jabber.org/protocol/chatstates");
-			final userState = switch (chatState?.name) {
-				case "active": UserState.Active;
-				case "inactive": UserState.Inactive;
-				case "gone": UserState.Gone;
-				case "composing": UserState.Composing;
-				case "paused": UserState.Paused;
-				default: null;
-			};
-			if (userState != null) {
-				final chat = getChat(from.asBare().asString());
-				if (chat == null || !chat.getParticipantDetails(message.senderId).isSelf) {
-					this.trigger("chat-state/update", { message: message, userState: userState });
-				}
+		final chatState = stanza.getChild(null, "http://jabber.org/protocol/chatstates");
+		final userState = switch (chatState?.name) {
+			case "active": UserState.Active;
+			case "inactive": UserState.Inactive;
+			case "gone": UserState.Gone;
+			case "composing": UserState.Composing;
+			case "paused": UserState.Paused;
+			default: null;
+		};
+		if (userState != null) {
+			final chat = getChat(from.asBare().asString());
+			if (chat == null || !chat.getParticipantDetails(message.senderId).isSelf) {
+				this.trigger("chat-state/update", { message: message, userState: userState });
 			}
 		}