From 8204e57a40af5d41d5df86da3387a1590704a5ac Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Tue, 9 Sep 2025 00:54:59 +0300 Subject: [PATCH] socket: fix onWhatsApp --- src/Signal/lid-mapping.ts | 3 ++- src/Socket/socket.ts | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Signal/lid-mapping.ts b/src/Signal/lid-mapping.ts index a031ce3f..03231736 100644 --- a/src/Signal/lid-mapping.ts +++ b/src/Signal/lid-mapping.ts @@ -90,7 +90,7 @@ export class LIDMappingStore { if (!lidUser) { logger.trace(`No LID mapping found for PN user ${pnUser}; getting from USync`) - const { exists, lid } = (await this.onWhatsAppFunc?.(pn))?.[0]! + const { exists, lid } = (await this.onWhatsAppFunc?.(pn))?.[0]! // this function already adds LIDs to mapping if (exists) { lidUser = jidDecode(lid)?.user } else { @@ -119,6 +119,7 @@ export class LIDMappingStore { // Look up reverse user mapping const lidUser = decoded.user + // TODO: remove this style and instead load all mappings somehow, and then assign them in the map const stored = await this.keys.get('lid-mapping', [`${lidUser}_reverse`]) const pnUser = stored[`${lidUser}_reverse`] diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index b177d8ec..7f3bf590 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -257,10 +257,8 @@ export const makeSocket = (config: SocketConfig) => { } const onWhatsApp = async (...jids: string[]) => { - const usyncQuery = new USyncQuery().withLIDProtocol() + const usyncQuery = new USyncQuery().withLIDProtocol().withContactProtocol() - // .withContactProtocol() when dealing with phone - // .withId simply with LIDs and WIDs for (const jid of jids) { if (isLidUser(jid)) { usyncQuery.withUser(new USyncUser().withId(jid)) // intentional