From 6ba7a8cdcfc473618b6ecb0fa8f2bd6b71c1e38e Mon Sep 17 00:00:00 2001 From: Martijn Poppen <7694138+martijnpoppen@users.noreply.github.com> Date: Fri, 26 Sep 2025 14:41:06 +0200 Subject: [PATCH] FIX: fromMe (#1796) --- src/Utils/decode-wa-message.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/Utils/decode-wa-message.ts b/src/Utils/decode-wa-message.ts index 9c31aa68..d2d877e4 100644 --- a/src/Utils/decode-wa-message.ts +++ b/src/Utils/decode-wa-message.ts @@ -121,6 +121,7 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin let msgType: MessageType let chatId: string let author: string + let fromMe: boolean = false const msgId = stanza.attrs.id const from = stanza.attrs.from @@ -138,6 +139,10 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin throw new Boom('receipient present, but msg not from me', { data: stanza }) } + if (isMe(from!) || isMeLid(from!)) { + fromMe = true + } + chatId = recipient } else { chatId = from! @@ -150,6 +155,10 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin throw new Boom('No participant in group message') } + if (isMe(participant) || isMeLid(participant)) { + fromMe = true + } + msgType = 'group' author = participant chatId = from! @@ -165,17 +174,22 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin msgType = isParticipantMe ? 'peer_broadcast' : 'other_broadcast' } + fromMe = isParticipantMe; chatId = from! author = participant } else if (isJidNewsletter(from)) { msgType = 'newsletter' chatId = from! author = from! + + if (isMe(from!) || isMeLid(from!)) { + fromMe = true + } + } else { throw new Boom('Unknown message type', { data: stanza }) } - const fromMe = (isLidUser(from) ? isMeLid : isMe)((stanza.attrs.participant || stanza.attrs.from)!) const pushname = stanza?.attrs?.notify const key: WAMessageKey = {