process-message: check fromMe properly in message addons
This commit is contained in:
@@ -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')
|
await upsertMessage(msg, node.attrs.offline ? 'append' : 'notify')
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ const REAL_MSG_STUB_TYPES = new Set([
|
|||||||
const REAL_MSG_REQ_ME_STUB_TYPES = new Set([WAMessageStubType.GROUP_PARTICIPANT_ADD])
|
const REAL_MSG_REQ_ME_STUB_TYPES = new Set([WAMessageStubType.GROUP_PARTICIPANT_ADD])
|
||||||
|
|
||||||
/** Cleans a received message to further processing */
|
/** 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
|
// ensure remoteJid and participant doesn't have device or agent in it
|
||||||
if (isHostedPnUser(message.key.remoteJid!) || isHostedLidUser(message.key.remoteJid!)) {
|
if (isHostedPnUser(message.key.remoteJid!) || isHostedLidUser(message.key.remoteJid!)) {
|
||||||
message.key.remoteJid = jidEncode(
|
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
|
// 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
|
// we've to correct the key to be from them, or some other participant
|
||||||
msgKey.fromMe = !msgKey.fromMe
|
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
|
: // if the message being reacted to, was from them
|
||||||
// fromMe automatically becomes false
|
// fromMe automatically becomes false
|
||||||
false
|
false
|
||||||
|
|||||||
Reference in New Issue
Block a user