cleanup: remove string lid / jid refs and improve hosted support
This commit is contained in:
@@ -1021,7 +1021,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
participant: attrs.participant
|
||||
}
|
||||
|
||||
if (shouldIgnoreJid(remoteJid!) && remoteJid !== '@s.whatsapp.net') {
|
||||
if (shouldIgnoreJid(remoteJid!) && remoteJid !== S_WHATSAPP_NET) {
|
||||
logger.debug({ remoteJid }, 'ignoring receipt from jid')
|
||||
await sendMessageAck(node)
|
||||
return
|
||||
@@ -1101,7 +1101,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
|
||||
const handleNotification = async (node: BinaryNode) => {
|
||||
const remoteJid = node.attrs.from
|
||||
if (shouldIgnoreJid(remoteJid!) && remoteJid !== '@s.whatsapp.net') {
|
||||
if (shouldIgnoreJid(remoteJid!) && remoteJid !== S_WHATSAPP_NET) {
|
||||
logger.debug({ remoteJid, id: node.attrs.id }, 'ignored notification')
|
||||
await sendMessageAck(node)
|
||||
return
|
||||
@@ -1137,7 +1137,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
}
|
||||
|
||||
const handleMessage = async (node: BinaryNode) => {
|
||||
if (shouldIgnoreJid(node.attrs.from!) && node.attrs.from !== '@s.whatsapp.net') {
|
||||
if (shouldIgnoreJid(node.attrs.from!) && node.attrs.from !== S_WHATSAPP_NET) {
|
||||
logger.debug({ key: node.attrs.key }, 'ignored message')
|
||||
await sendMessageAck(node, NACK_REASONS.UnhandledError)
|
||||
return
|
||||
@@ -1290,22 +1290,6 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
const from = infoChild.attrs.from! || infoChild.attrs['call-creator']!
|
||||
status = getCallStatusFromNode(infoChild)
|
||||
|
||||
if (isLidUser(from) && infoChild.tag === 'relaylatency') {
|
||||
const verify = await callOfferCache.get(callId)
|
||||
if (!verify) {
|
||||
status = 'offer'
|
||||
const callLid: WACallEvent = {
|
||||
chatId: attrs.from!,
|
||||
from,
|
||||
id: callId,
|
||||
date: new Date(+attrs.t! * 1000),
|
||||
offline: !!attrs.offline,
|
||||
status
|
||||
}
|
||||
await callOfferCache.set(callId, callLid)
|
||||
}
|
||||
}
|
||||
|
||||
const call: WACallEvent = {
|
||||
chatId: attrs.from!,
|
||||
from,
|
||||
|
||||
Reference in New Issue
Block a user