lid, wip: Support LIDs in Baileys (#1747)
* lid-mapping: get missing lid from usync * lid-mapping, jid-utils: change to isPnUser and store multiple mappings * process-message: parse protocolMsg mapping, and store from new msgs * types: lid-mapping event, addressing enum, alt, contact, group types * validate, decode: use lid for identity, better logic * lid: final commit * linting * linting * linting * linting * misc: fix testing and also remove version json * lint: IDE fucking up lint * lid-mapping: fix build error on NPM * message-retry: fix proto import
This commit is contained in:
+4
-19
@@ -53,7 +53,7 @@ import {
|
||||
S_WHATSAPP_NET
|
||||
} from '../WABinary'
|
||||
import { USyncQuery, USyncUser } from '../WAUSync'
|
||||
import { makeUSyncSocket } from './usync'
|
||||
import { makeSocket } from './socket.js'
|
||||
const MAX_SYNC_ATTEMPTS = 2
|
||||
|
||||
export const makeChatsSocket = (config: SocketConfig) => {
|
||||
@@ -65,8 +65,8 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
shouldIgnoreJid,
|
||||
shouldSyncHistoryMessage
|
||||
} = config
|
||||
const sock = makeUSyncSocket(config)
|
||||
const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError } = sock
|
||||
const sock = makeSocket(config)
|
||||
const { ev, ws, authState, generateMessageTag, sendNode, query, signalRepository, onUnexpectedError } = sock
|
||||
|
||||
let privacySettings: { [_: string]: string } | undefined
|
||||
|
||||
@@ -221,21 +221,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
return botList
|
||||
}
|
||||
|
||||
const onWhatsApp = async (...jids: string[]) => {
|
||||
const usyncQuery = new USyncQuery().withContactProtocol().withLIDProtocol()
|
||||
|
||||
for (const jid of jids) {
|
||||
const phone = `+${jid.replace('+', '').split('@')[0]?.split(':')[0]}`
|
||||
usyncQuery.withUser(new USyncUser().withPhone(phone))
|
||||
}
|
||||
|
||||
const results = await sock.executeUSyncQuery(usyncQuery)
|
||||
|
||||
if (results) {
|
||||
return results.list.filter(a => !!a.contact).map(({ contact, id, lid }) => ({ jid: id, exists: contact, lid }))
|
||||
}
|
||||
}
|
||||
|
||||
const fetchStatus = async (...jids: string[]) => {
|
||||
const usyncQuery = new USyncQuery().withStatusProtocol()
|
||||
|
||||
@@ -1092,6 +1077,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
}
|
||||
})(),
|
||||
processMessage(msg, {
|
||||
signalRepository,
|
||||
shouldProcessHistoryMsg,
|
||||
placeholderResendCache,
|
||||
ev,
|
||||
@@ -1195,7 +1181,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
sendPresenceUpdate,
|
||||
presenceSubscribe,
|
||||
profilePictureUrl,
|
||||
onWhatsApp,
|
||||
fetchBlocklist,
|
||||
fetchStatus,
|
||||
fetchDisappearingDuration,
|
||||
|
||||
Reference in New Issue
Block a user