FIX: fromMe (#1796)

This commit is contained in:
Martijn Poppen
2025-09-26 14:41:06 +02:00
committed by GitHub
parent 573ed2c427
commit 6ba7a8cdcf
+15 -1
View File
@@ -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 = {