process-message: check fromMe properly in message addons

This commit is contained in:
Rajeh Taher
2025-10-18 20:28:58 +03:00
parent ca50338be1
commit 07536dedfc
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -1267,7 +1267,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
}
}
cleanMessage(msg, authState.creds.me!.id)
cleanMessage(msg, authState.creds.me!.id, authState.creds.me!.lid!)
await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify')
})
+2 -2
View File
@@ -53,7 +53,7 @@ const REAL_MSG_STUB_TYPES = new Set([
const REAL_MSG_REQ_ME_STUB_TYPES = new Set([WAMessageStubType.GROUP_PARTICIPANT_ADD])
/** Cleans a received message to further processing */
export const cleanMessage = (message: WAMessage, meId: string) => {
export const cleanMessage = (message: WAMessage, meId: string, meLid: string) => {
// ensure remoteJid and participant doesn't have device or agent in it
if (isHostedPnUser(message.key.remoteJid!) || isHostedLidUser(message.key.remoteJid!)) {
message.key.remoteJid = jidEncode(
@@ -90,7 +90,7 @@ export const cleanMessage = (message: WAMessage, meId: string) => {
// if the sender believed the message being reacted to is not from them
// we've to correct the key to be from them, or some other participant
msgKey.fromMe = !msgKey.fromMe
? areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meId)
? areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meId) || areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meLid)
: // if the message being reacted to, was from them
// fromMe automatically becomes false
false