message: Add addressing mode
This commit is contained in:
@@ -261,22 +261,23 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
const onWhatsApp = async (...jids: string[]) => {
|
const onWhatsApp = async (...jids: string[]) => {
|
||||||
let usyncQuery = new USyncQuery().withLIDProtocol()
|
let usyncQuery = new USyncQuery().withLIDProtocol()
|
||||||
|
|
||||||
let contactEnabled = false;
|
let contactEnabled = false
|
||||||
for (const jid of jids) {
|
for (const jid of jids) {
|
||||||
if (isLidUser(jid)) {
|
if (isLidUser(jid)) {
|
||||||
// usyncQuery.withUser(new USyncUser().withLid(jid)) // intentional but needs JID too
|
// usyncQuery.withUser(new USyncUser().withLid(jid)) // intentional but needs JID too
|
||||||
continue;
|
continue
|
||||||
} else {
|
} else {
|
||||||
if (!contactEnabled) {
|
if (!contactEnabled) {
|
||||||
contactEnabled = true
|
contactEnabled = true
|
||||||
usyncQuery = usyncQuery.withContactProtocol()
|
usyncQuery = usyncQuery.withContactProtocol()
|
||||||
}
|
}
|
||||||
|
|
||||||
const phone = `+${jid.replace('+', '').split('@')[0]?.split(':')[0]}`
|
const phone = `+${jid.replace('+', '').split('@')[0]?.split(':')[0]}`
|
||||||
usyncQuery.withUser(new USyncUser().withPhone(phone))
|
usyncQuery.withUser(new USyncUser().withPhone(phone))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usyncQuery.users.length == 0) {
|
if (usyncQuery.users.length === 0) {
|
||||||
return [] // return early without forcing an empty query
|
return [] // return early without forcing an empty query
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export type WAMessageKey = proto.IMessageKey & {
|
|||||||
remoteJidAlt?: string
|
remoteJidAlt?: string
|
||||||
participantAlt?: string
|
participantAlt?: string
|
||||||
server_id?: string
|
server_id?: string
|
||||||
|
addressingMode?: string
|
||||||
isViewOnce?: boolean // TODO: remove out of the message key, place in WebMessageInfo
|
isViewOnce?: boolean // TODO: remove out of the message key, place in WebMessageInfo
|
||||||
}
|
}
|
||||||
export type WATextMessage = proto.Message.IExtendedTextMessage
|
export type WATextMessage = proto.Message.IExtendedTextMessage
|
||||||
|
|||||||
@@ -185,6 +185,7 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
|
|||||||
id: msgId,
|
id: msgId,
|
||||||
participant,
|
participant,
|
||||||
participantAlt: isJidGroup(chatId) ? addressingContext.senderAlt : undefined,
|
participantAlt: isJidGroup(chatId) ? addressingContext.senderAlt : undefined,
|
||||||
|
addressingMode: addressingContext.addressingMode,
|
||||||
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
|
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user