Skip to content

Commit 37d729b

Browse files
committed
messages-recv, decode-wa-message: handle storing new pairs better + lint
1 parent 1afc566 commit 37d729b

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/Socket/messages-recv.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,15 +1128,13 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
11281128
const altServer = jidDecode(alt)?.server
11291129
const primaryJid = msg.key.participant || msg.key.remoteJid!
11301130
if (altServer === 'lid') {
1131-
if (typeof (await signalRepository.lidMapping.getPNForLID(alt)) === 'string') {
1131+
if (!(await signalRepository.lidMapping.getPNForLID(alt))) {
11321132
await signalRepository.lidMapping.storeLIDPNMappings([{ lid: alt, pn: primaryJid }])
11331133
await signalRepository.migrateSession(primaryJid, alt)
11341134
}
11351135
} else {
1136-
if (typeof (await signalRepository.lidMapping.getLIDForPN(alt)) === 'string') {
1137-
await signalRepository.lidMapping.storeLIDPNMappings([{ lid: primaryJid, pn: alt }])
1138-
await signalRepository.migrateSession(alt, primaryJid)
1139-
}
1136+
await signalRepository.lidMapping.storeLIDPNMappings([{ lid: primaryJid, pn: alt }])
1137+
await signalRepository.migrateSession(alt, primaryJid)
11401138
}
11411139
}
11421140

src/Utils/decode-wa-message.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ import {
1313
isJidNewsletter,
1414
isJidStatusBroadcast,
1515
isLidUser,
16-
isPnUser,
17-
// transferDevice
16+
isPnUser
17+
// transferDevice
1818
} from '../WABinary'
1919
import { unpadRandomMax16 } from './generics'
2020
import type { ILogger } from './logger'
2121
import { decodeAndHydrate } from './proto-utils'
2222

2323
const getDecryptionJid = async (sender: string, repository: SignalRepositoryWithLIDStore): Promise<string> => {
24-
if (!sender.includes('@s.whatsapp.net')) {
24+
if (sender.includes('@lid')) {
2525
return sender
2626
}
2727

0 commit comments

Comments
 (0)