mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
support mesasge input from lid
This commit is contained in:
@@ -655,6 +655,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
const { fullMessage: msg, category, author, decrypt } = decryptMessageNode(
|
||||
node,
|
||||
authState.creds.me!.id,
|
||||
authState.creds.me!.lid || '',
|
||||
signalRepository,
|
||||
logger,
|
||||
)
|
||||
|
||||
@@ -15,7 +15,8 @@ type MessageType = 'chat' | 'peer_broadcast' | 'other_broadcast' | 'group' | 'di
|
||||
*/
|
||||
export function decodeMessageNode(
|
||||
stanza: BinaryNode,
|
||||
meId: string
|
||||
meId: string,
|
||||
meLid: string
|
||||
) {
|
||||
let msgType: MessageType
|
||||
let chatId: string
|
||||
@@ -27,6 +28,7 @@ export function decodeMessageNode(
|
||||
const recipient: string | undefined = stanza.attrs.recipient
|
||||
|
||||
const isMe = (jid: string) => areJidsSameUser(jid, meId)
|
||||
const isMeLid = (jid: string) => areJidsSameUser(jid, meLid)
|
||||
|
||||
if(isJidUser(from)) {
|
||||
if(recipient) {
|
||||
@@ -43,7 +45,7 @@ export function decodeMessageNode(
|
||||
author = from
|
||||
} else if(isLidUser(from)) {
|
||||
if(recipient) {
|
||||
if(!isMe(from)) {
|
||||
if(!isMeLid(from)) {
|
||||
throw new Boom('receipient present, but msg not from me', { data: stanza })
|
||||
}
|
||||
|
||||
@@ -111,10 +113,11 @@ export function decodeMessageNode(
|
||||
export const decryptMessageNode = (
|
||||
stanza: BinaryNode,
|
||||
meId: string,
|
||||
meLid: string,
|
||||
repository: SignalRepository,
|
||||
logger: Logger
|
||||
) => {
|
||||
const { fullMessage, author, sender } = decodeMessageNode(stanza, meId)
|
||||
const { fullMessage, author, sender } = decodeMessageNode(stanza, meId, meLid)
|
||||
return {
|
||||
fullMessage,
|
||||
category: stanza.attrs.category,
|
||||
|
||||
Reference in New Issue
Block a user