git » sdk » commit 2ff342e

Don't query for type on blocked jid

author Stephen Paul Weber
2024-11-12 04:33:42 UTC
committer Stephen Paul Weber
2024-11-12 04:33:42 UTC
parent 6f3c08946abf058cd77d955f10625f40176a01ef

Don't query for type on blocked jid

Since the server won't let us talk to them anyway

snikket/Client.hx +2 -6

diff --git a/snikket/Client.hx b/snikket/Client.hx
index e26b047..e5c5beb 100644
--- a/snikket/Client.hx
+++ b/snikket/Client.hx
@@ -1250,12 +1250,8 @@ class Client extends EventEmitter {
 	}
 
 	private function serverBlocked(blocked: String) {
-		final chat = getChat(blocked);
-		if (chat == null) {
-			startChatWith(blocked, (caps) -> Closed, (chat) -> chat.block(null, false));
-		} else {
-			chat.block(null, false);
-		}
+		final chat = getChat(blocked) ?? getDirectChat(blocked, false);
+		chat.block(null, false);
 	}
 
 	// This is called right before we're going to trigger for all chats anyway, so don't bother with single triggers