From 07536dedfc35fbd4ca9266a927ea3f93a0e2c3ae Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sat, 18 Oct 2025 20:28:58 +0300 Subject: [PATCH] process-message: check fromMe properly in message addons --- src/Socket/messages-recv.ts | 2 +- src/Utils/process-message.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Socket/messages-recv.ts b/src/Socket/messages-recv.ts index d56d5aa1..e0e17681 100644 --- a/src/Socket/messages-recv.ts +++ b/src/Socket/messages-recv.ts @@ -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') }) diff --git a/src/Utils/process-message.ts b/src/Utils/process-message.ts index df1759e3..89a1677a 100644 --- a/src/Utils/process-message.ts +++ b/src/Utils/process-message.ts @@ -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