FIX: fromMe (#1796)
This commit is contained in:
@@ -121,6 +121,7 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
|
|||||||
let msgType: MessageType
|
let msgType: MessageType
|
||||||
let chatId: string
|
let chatId: string
|
||||||
let author: string
|
let author: string
|
||||||
|
let fromMe: boolean = false
|
||||||
|
|
||||||
const msgId = stanza.attrs.id
|
const msgId = stanza.attrs.id
|
||||||
const from = stanza.attrs.from
|
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 })
|
throw new Boom('receipient present, but msg not from me', { data: stanza })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isMe(from!) || isMeLid(from!)) {
|
||||||
|
fromMe = true
|
||||||
|
}
|
||||||
|
|
||||||
chatId = recipient
|
chatId = recipient
|
||||||
} else {
|
} else {
|
||||||
chatId = from!
|
chatId = from!
|
||||||
@@ -150,6 +155,10 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
|
|||||||
throw new Boom('No participant in group message')
|
throw new Boom('No participant in group message')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isMe(participant) || isMeLid(participant)) {
|
||||||
|
fromMe = true
|
||||||
|
}
|
||||||
|
|
||||||
msgType = 'group'
|
msgType = 'group'
|
||||||
author = participant
|
author = participant
|
||||||
chatId = from!
|
chatId = from!
|
||||||
@@ -165,17 +174,22 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
|
|||||||
msgType = isParticipantMe ? 'peer_broadcast' : 'other_broadcast'
|
msgType = isParticipantMe ? 'peer_broadcast' : 'other_broadcast'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fromMe = isParticipantMe;
|
||||||
chatId = from!
|
chatId = from!
|
||||||
author = participant
|
author = participant
|
||||||
} else if (isJidNewsletter(from)) {
|
} else if (isJidNewsletter(from)) {
|
||||||
msgType = 'newsletter'
|
msgType = 'newsletter'
|
||||||
chatId = from!
|
chatId = from!
|
||||||
author = from!
|
author = from!
|
||||||
|
|
||||||
|
if (isMe(from!) || isMeLid(from!)) {
|
||||||
|
fromMe = true
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Boom('Unknown message type', { data: stanza })
|
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 pushname = stanza?.attrs?.notify
|
||||||
|
|
||||||
const key: WAMessageKey = {
|
const key: WAMessageKey = {
|
||||||
|
|||||||
Reference in New Issue
Block a user