From 5b1171312eb33bbc84a0d2da30256cfbde64de3b Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sun, 1 Oct 2023 15:18:03 +0300 Subject: [PATCH] Update messages-send.ts --- src/Socket/messages-send.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Socket/messages-send.ts b/src/Socket/messages-send.ts index 92b8916..cf7031f 100644 --- a/src/Socket/messages-send.ts +++ b/src/Socket/messages-send.ts @@ -378,7 +378,7 @@ export const makeMessagesSocket = (config: SocketConfig) => { devices.push(...additionalDevices) } - const patched = await patchMessageBeforeSending(message, devices.map(d => jidEncode(d.user, 's.whatsapp.net', d.device))) + const patched = await patchMessageBeforeSending(message, devices.map(d => jidEncode(d.user, d.domainType == 0 ? 's.whatsapp.net' : 'lid', d.device))) const bytes = encodeWAMessage(patched) const { ciphertext, senderKeyDistributionMessage } = await signalRepository.encryptGroupMessage( @@ -391,8 +391,8 @@ export const makeMessagesSocket = (config: SocketConfig) => { const senderKeyJids: string[] = [] // ensure a connection is established with every device - for(const { user, device } of devices) { - const jid = jidEncode(user, 's.whatsapp.net', device) + for(const { user, device,domainType } of devices) { + const jid = jidEncode(user, domainType == 0 ? 's.whatsapp.net' : 'lid', device) if(!senderKeyMap[jid] || !!participant) { senderKeyJids.push(jid) // store that this person has had the sender keys sent to them @@ -444,8 +444,8 @@ export const makeMessagesSocket = (config: SocketConfig) => { const allJids: string[] = [] const meJids: string[] = [] const otherJids: string[] = [] - for(const { user, device } of devices) { - const jid = jidEncode(user, 's.whatsapp.net', device) + for(const { user, device,domainType } of devices) { + const jid = jidEncode(user, domainType == 0 ?'s.whatsapp.net' : 'lid', device) const isMe = user === meUser if(isMe) { meJids.push(jid)