libsignal,lid-mapping, etc.: Partially fix "No sessions" on hosted JIDs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { LRUCache } from 'lru-cache'
|
||||
import type { LIDMapping, SignalKeyStoreWithTransaction } from '../Types'
|
||||
import type { ILogger } from '../Utils/logger'
|
||||
import { isJidHostedLidUser, isJidHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser } from '../WABinary'
|
||||
import { isHostedLidUser, isHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser } from '../WABinary'
|
||||
|
||||
export class LIDMappingStore {
|
||||
private readonly mappingCache = new LRUCache<string, string>({
|
||||
@@ -93,7 +93,7 @@ export class LIDMappingStore {
|
||||
// mapped from pn to lid mapping to prevent duplication in results later
|
||||
const successfulPairs: { [_: string]: LIDMapping } = {}
|
||||
for (const pn of pns) {
|
||||
if (!isPnUser(pn)) continue
|
||||
if (!isPnUser(pn) && !isHostedPnUser(pn)) continue
|
||||
|
||||
const decoded = jidDecode(pn)
|
||||
if (!decoded) continue
|
||||
@@ -114,7 +114,7 @@ export class LIDMappingStore {
|
||||
this.logger.trace(`No LID mapping found for PN user ${pnUser}; batch getting from USync`)
|
||||
const device = decoded.device || 0
|
||||
let normalizedPn = jidNormalizedUser(pn)
|
||||
if (isJidHostedLidUser(normalizedPn) || isJidHostedPnUser(normalizedPn)) {
|
||||
if (isHostedLidUser(normalizedPn) || isHostedPnUser(normalizedPn)) {
|
||||
normalizedPn = `${pnUser}@s.whatsapp.net`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user