git » sdk » commit 2751744

Do not notify of my own chat state

author Stephen Paul Weber
2024-11-13 16:34:00 UTC
committer Stephen Paul Weber
2024-11-13 16:34:00 UTC
parent ba57f62fbf7616ecf60045afb7b4ce13b0930eb9

Do not notify of my own chat state

snikket/Client.hx +5 -2

diff --git a/snikket/Client.hx b/snikket/Client.hx
index 766a88e..28870b3 100644
--- a/snikket/Client.hx
+++ b/snikket/Client.hx
@@ -251,8 +251,11 @@ class Client extends EventEmitter {
 					default: null;
 				};
 				if (userState != null) {
-					for (handler in chatStateHandlers) {
-						handler(message.senderId, message.chatId, message.threadId, userState);
+					final chat = getChat(from.asBare().asString());
+					if (chat == null || !chat.getParticipantDetails(message.senderId).isSelf) {
+						for (handler in chatStateHandlers) {
+							handler(message.senderId, message.chatId, message.threadId, userState);
+						}
 					}
 				}
 			}