Skip to content

Commit d9fed62

Browse files
committed
message: Add addressing mode
1 parent 4344e51 commit d9fed62

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

src/Socket/socket.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,22 +261,23 @@ export const makeSocket = (config: SocketConfig) => {
261261
const onWhatsApp = async (...jids: string[]) => {
262262
let usyncQuery = new USyncQuery().withLIDProtocol()
263263

264-
let contactEnabled = false;
264+
let contactEnabled = false
265265
for (const jid of jids) {
266266
if (isLidUser(jid)) {
267267
// usyncQuery.withUser(new USyncUser().withLid(jid)) // intentional but needs JID too
268-
continue;
268+
continue
269269
} else {
270270
if (!contactEnabled) {
271271
contactEnabled = true
272272
usyncQuery = usyncQuery.withContactProtocol()
273273
}
274+
274275
const phone = `+${jid.replace('+', '').split('@')[0]?.split(':')[0]}`
275276
usyncQuery.withUser(new USyncUser().withPhone(phone))
276277
}
277278
}
278279

279-
if (usyncQuery.users.length == 0) {
280+
if (usyncQuery.users.length === 0) {
280281
return [] // return early without forcing an empty query
281282
}
282283

src/Types/Message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export type WAMessageKey = proto.IMessageKey & {
1717
remoteJidAlt?: string
1818
participantAlt?: string
1919
server_id?: string
20+
addressingMode?: string
2021
isViewOnce?: boolean // TODO: remove out of the message key, place in WebMessageInfo
2122
}
2223
export type WATextMessage = proto.Message.IExtendedTextMessage

src/Utils/decode-wa-message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ export function decodeMessageNode(stanza: BinaryNode, meId: string, meLid: strin
185185
id: msgId,
186186
participant,
187187
participantAlt: isJidGroup(chatId) ? addressingContext.senderAlt : undefined,
188+
addressingMode: addressingContext.addressingMode,
188189
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
189190
}
190191

0 commit comments

Comments
 (0)