From 83a6956b442f7b661f19c25d6f1a753e7a61f865 Mon Sep 17 00:00:00 2001 From: Wender Teixeira Date: Tue, 24 Jun 2025 17:51:46 -0300 Subject: [PATCH] fix disconnect error when using sendPresenceUpdate with LID (#1545) * chore: change version web * fix: enhance pairing response validation and adjust HMAC handling for hosted devices * refactor: remove unused 'from' attribute in chatstate message * feat: update chatstate message to conditionally set 'from' attribute based on server type --- src/Socket/chats.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Socket/chats.ts b/src/Socket/chats.ts index ab5b2b3..bed2f79 100644 --- a/src/Socket/chats.ts +++ b/src/Socket/chats.ts @@ -44,6 +44,7 @@ import { BinaryNode, getBinaryNodeChild, getBinaryNodeChildren, + jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET @@ -637,10 +638,13 @@ export const makeChatsSocket = (config: SocketConfig) => { } }) } else { + const { server } = jidDecode(toJid)! + const isLid = server === 'lid' + await sendNode({ tag: 'chatstate', attrs: { - from: me.id, + from: isLid ? me.lid! : me.id, to: toJid! }, content: [