mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: possible ack issue
This commit is contained in:
@@ -5,7 +5,7 @@ import { MessageReceiptType, MessageRelayOptions, MessageUserReceipt, SocketConf
|
|||||||
import { decodeMediaRetryNode, decodeMessageStanza, delay, encodeBigEndian, getCallStatusFromNode, getNextPreKeys, getStatusFromReceiptType, isHistoryMsg, unixTimestampSeconds, xmppPreKey, xmppSignedPreKey } from '../Utils'
|
import { decodeMediaRetryNode, decodeMessageStanza, delay, encodeBigEndian, getCallStatusFromNode, getNextPreKeys, getStatusFromReceiptType, isHistoryMsg, unixTimestampSeconds, xmppPreKey, xmppSignedPreKey } from '../Utils'
|
||||||
import { makeMutex } from '../Utils/make-mutex'
|
import { makeMutex } from '../Utils/make-mutex'
|
||||||
import { cleanMessage } from '../Utils/process-message'
|
import { cleanMessage } from '../Utils/process-message'
|
||||||
import { areJidsSameUser, BinaryNode, BinaryNodeAttributes, getAllBinaryNodeChildren, getBinaryNodeChild, getBinaryNodeChildren, isJidGroup, isJidUser, jidDecode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary'
|
import { areJidsSameUser, BinaryNode, getAllBinaryNodeChildren, getBinaryNodeChild, getBinaryNodeChildren, isJidGroup, isJidUser, jidDecode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary'
|
||||||
import { extractGroupMetadata } from './groups'
|
import { extractGroupMetadata } from './groups'
|
||||||
import { makeMessagesSocket } from './messages-send'
|
import { makeMessagesSocket } from './messages-send'
|
||||||
|
|
||||||
@@ -39,14 +39,13 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
let sendActiveReceipts = false
|
let sendActiveReceipts = false
|
||||||
|
|
||||||
const sendMessageAck = async({ tag, attrs }: BinaryNode, extraAttrs: BinaryNodeAttributes = { }) => {
|
const sendMessageAck = async({ tag, attrs }: BinaryNode) => {
|
||||||
const stanza: BinaryNode = {
|
const stanza: BinaryNode = {
|
||||||
tag: 'ack',
|
tag: 'ack',
|
||||||
attrs: {
|
attrs: {
|
||||||
id: attrs.id,
|
id: attrs.id,
|
||||||
to: attrs.from,
|
to: attrs.from,
|
||||||
class: tag,
|
class: tag,
|
||||||
...extraAttrs,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,7 +53,11 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
stanza.attrs.participant = attrs.participant
|
stanza.attrs.participant = attrs.participant
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tag !== 'message' && attrs.type && !extraAttrs.type) {
|
if(!!attrs.recipient) {
|
||||||
|
stanza.attrs.recipient = attrs.recipient
|
||||||
|
}
|
||||||
|
|
||||||
|
if(tag !== 'message' && attrs.type) {
|
||||||
stanza.attrs.type = attrs.type
|
stanza.attrs.type = attrs.type
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,7 +519,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
ev.emit('call', [call])
|
ev.emit('call', [call])
|
||||||
|
|
||||||
await sendMessageAck(node, { type: infoChild.tag })
|
await sendMessageAck(node)
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleBadAck = async({ attrs }: BinaryNode) => {
|
const handleBadAck = async({ attrs }: BinaryNode) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user