Update decode-wa-message.ts

This commit is contained in:
Rajeh Taher
2023-09-30 21:29:40 +03:00
committed by GitHub
parent d20830e43f
commit e15d2ffe30

View File

@@ -2,7 +2,7 @@ import { Boom } from '@hapi/boom'
import { Logger } from 'pino'
import { proto } from '../../WAProto'
import { SignalRepository, WAMessageKey } from '../Types'
import { areJidsSameUser, BinaryNode, isJidBroadcast, isJidGroup, isJidStatusBroadcast, isJidUser } from '../WABinary'
import { areJidsSameUser, BinaryNode, isJidBroadcast, isJidGroup, isJidStatusBroadcast, isJidUser, isLidUser } from '../WABinary'
import { unpadRandomMax16 } from './generics'
const NO_MESSAGE_FOUND_ERROR_TEXT = 'Message absent from node'
@@ -39,6 +39,19 @@ export function decodeMessageNode(
chatId = from
}
msgType = 'chat'
author = from
} else if (isLidUser(from)) {
if(recipient) {
if(!isMe(from)) {
throw new Boom('receipient present, but msg not from me', { data: stanza })
}
chatId = recipient
} else {
chatId = from
}
msgType = 'chat'
author = from
} else if(isJidGroup(from)) {
@@ -183,4 +196,4 @@ export const decryptMessageNode = (
}
}
}
}
}