Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions patches/baileys+7.0.0-rc13.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/node_modules/baileys/lib/Socket/messages-recv.js b/node_modules/baileys/lib/Socket/messages-recv.js
index f2003ac..f6ef9e0 100644
--- a/node_modules/baileys/lib/Socket/messages-recv.js
+++ b/node_modules/baileys/lib/Socket/messages-recv.js
@@ -1576,11 +1576,25 @@ export const makeMessagesRecvSocket = (config) => {
return exec(node, false).catch(err => onUnexpectedError(err, identifier));
}
};
+ // Some accounts now get contacts' statuses as a top-level <status> stanza
+ // instead of <message from="status@broadcast">. It isn't decoded here, but it
+ // must be acked: otherwise the server ends the stream ~50 minutes later with
+ // <stream:error><ack class="status"/></stream:error> and holds back new messages.
+ // Backport of WhiskeySockets/Baileys#2883.
+ const handleStatus = async (node) => {
+ try {
+ await sendMessageAck(node);
+ }
+ catch (error) {
+ onUnexpectedError(error, 'acking status stanza');
+ }
+ };
const offlineNodeProcessor = makeOfflineNodeProcessor(new Map([
['message', handleMessage],
['call', handleCall],
['receipt', handleReceipt],
- ['notification', handleNotification]
+ ['notification', handleNotification],
+ ['status', handleStatus]
]), {
isWsOpen: () => ws.isOpen,
onUnexpectedError,
@@ -1621,6 +1635,10 @@ export const makeMessagesRecvSocket = (config) => {
ws.on('CB:notification', async (node) => {
await processNode('notification', node, 'handling notification', handleNotification);
});
+ ws.on('CB:status', async (node) => {
+ // processNode acks ignored JIDs itself, outside handleStatus' try/catch
+ await processNode('status', node, 'acking status stanza', handleStatus).catch(error => onUnexpectedError(error, 'acking status stanza'));
+ });
ws.on('CB:ack,class:message', (node) => {
handleBadAck(node).catch(error => onUnexpectedError(error, 'handling bad ack'));
});