decode-wa-message, process-message: Fix @hosted lids processing

This commit is contained in:
Rajeh Taher
2025-10-03 00:05:01 +03:00
parent 592f70b81d
commit 50b36ece3b
6 changed files with 39 additions and 14 deletions
+6 -4
View File
@@ -7,12 +7,14 @@ import {
type BinaryNode,
isJidBroadcast,
isJidGroup,
isJidHostedLidUser,
isJidHostedPnUser,
isJidMetaAI,
isJidNewsletter,
isJidStatusBroadcast,
isLidUser,
isPnUser,
transferDevice
// transferDevice
} from '../WABinary'
import { unpadRandomMax16 } from './generics'
import type { ILogger } from './logger'
@@ -95,7 +97,7 @@ export const extractAddressingContext = (stanza: BinaryNode) => {
senderAlt = stanza.attrs.participant_pn || stanza.attrs.sender_pn || stanza.attrs.peer_recipient_pn
recipientAlt = stanza.attrs.recipient_pn
// with device data
if (sender && senderAlt) senderAlt = transferDevice(sender, senderAlt)
//if (sender && senderAlt) senderAlt = transferDevice(sender, senderAlt)
} else {
// Message is PN-addressed: sender is PN, extract corresponding LID
// without device data
@@ -103,7 +105,7 @@ export const extractAddressingContext = (stanza: BinaryNode) => {
recipientAlt = stanza.attrs.recipient_lid
//with device data
if (sender && senderAlt) senderAlt = transferDevice(sender, senderAlt)
//if (sender && senderAlt) senderAlt = transferDevice(sender, senderAlt)
}
return {
@@ -133,7 +135,7 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
const isMe = (jid: string) => areJidsSameUser(jid, meId)
const isMeLid = (jid: string) => areJidsSameUser(jid, meLid)
if (isPnUser(from) || isLidUser(from)) {
if (isPnUser(from) || isLidUser(from) || isJidHostedLidUser(from) || isJidHostedPnUser(from)) {
if (recipient && !isJidMetaAI(recipient)) {
if (!isMe(from!) && !isMeLid(from!)) {
throw new Boom('receipient present, but msg not from me', { data: stanza })