mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: correctly handle retry from own devices
This commit is contained in:
@@ -494,9 +494,11 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
const handleReceipt = async(node: BinaryNode) => {
|
const handleReceipt = async(node: BinaryNode) => {
|
||||||
let shouldAck = true
|
let shouldAck = true
|
||||||
|
|
||||||
const { attrs, content } = node
|
const { attrs, content } = node
|
||||||
|
const isNodeFromMe = areJidsSameUser(attrs.from, authState.creds.me?.id)
|
||||||
const remoteJid = attrs.recipient || attrs.from
|
const remoteJid = attrs.recipient || attrs.from
|
||||||
const fromMe = attrs.recipient ? false : true
|
const fromMe = isNodeFromMe || (attrs.recipient ? false : true)
|
||||||
|
|
||||||
const ids = [attrs.id]
|
const ids = [attrs.id]
|
||||||
if(Array.isArray(content)) {
|
if(Array.isArray(content)) {
|
||||||
@@ -512,7 +514,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const status = getStatusFromReceiptType(attrs.type)
|
const status = getStatusFromReceiptType(attrs.type)
|
||||||
if(typeof status !== 'undefined' && !areJidsSameUser(attrs.from, authState.creds.me?.id)) {
|
if(typeof status !== 'undefined' && !isNodeFromMe) {
|
||||||
ev.emit('messages.update', ids.map(id => ({
|
ev.emit('messages.update', ids.map(id => ({
|
||||||
key: { ...key, id },
|
key: { ...key, id },
|
||||||
update: { status }
|
update: { status }
|
||||||
@@ -520,6 +522,8 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(attrs.type === 'retry') {
|
if(attrs.type === 'retry') {
|
||||||
|
// correctly set who is asking for the retry
|
||||||
|
key.participant = key.participant || attrs.from
|
||||||
if(key.fromMe) {
|
if(key.fromMe) {
|
||||||
try {
|
try {
|
||||||
logger.debug({ attrs }, 'recv retry request')
|
logger.debug({ attrs }, 'recv retry request')
|
||||||
|
|||||||
Reference in New Issue
Block a user