@neelegirly/baileys 2.2.26 → 2.2.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,6 +56,9 @@ const makeMessagesRecvSocket = (config) => {
56
56
  createParticipantNodes,
57
57
  sendPeerDataOperationMessage,
58
58
  fetchAccountReachoutTimelock,
59
+ // OniSelf fork fix: needed by sendMessagesAgain() as fallback message
60
+ // source for incoming retry receipts (see comment there).
61
+ messageRetryManager,
59
62
  } = Neele;
60
63
 
61
64
  /** this mutex ensures that each retryRequest will wait for the previous one to finish */
@@ -1133,7 +1136,27 @@ const makeMessagesRecvSocket = (config) => {
1133
1136
  };
1134
1137
 
1135
1138
  const sendMessagesAgain = async (key, ids, retryNode) => {
1136
- const msgs = await Promise.all(ids.map((id) => getMessage({ ...key, id })));
1139
+ // ╭─ OniSelf fork fix (bug ≤2.2.26, shipped in 2.2.27) ───────────────────╮
1140
+ // │ BUG: this fork populates messageRetryManager's recent-message cache │
1141
+ // │ on every outgoing send (enableRecentMessageCache defaults to true, │
1142
+ // │ see messages-send.js "addRecentMessage") but never read it back │
1143
+ // │ here. With the default `getMessage: async () => undefined` every │
1144
+ // │ incoming retry receipt from a peer died with "recv retry request, │
1145
+ // │ but message not available" — the recipient stayed stuck on │
1146
+ // │ WhatsApp's "Waiting for this message" placeholder forever. │
1147
+ // │ Upstream Baileys consults the recent-message cache as fallback; │
1148
+ // │ this restores exactly that behaviour. No security check is touched: │
1149
+ // │ we only re-encrypt a message WE sent moments ago for the SAME │
1150
+ // │ recipient, via the normal relayMessage path below. │
1151
+ // ╰───────────────────────────────────────────────────────────────────────╯
1152
+ const msgs = await Promise.all(
1153
+ ids.map(async (id) => {
1154
+ const msg = await getMessage({ ...key, id });
1155
+ if (msg) return msg;
1156
+ const recent = messageRetryManager?.getRecentMessage(key.remoteJid, id);
1157
+ return recent?.message;
1158
+ })
1159
+ );
1137
1160
  const remoteJid = key.remoteJid;
1138
1161
  const participant = key.participant || remoteJid;
1139
1162
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neelegirly/baileys",
3
- "version": "2.2.26",
3
+ "version": "2.2.27",
4
4
  "description": "Neelegirly fork of Baileys: multi-device WhatsApp Web API for Node.js",
5
5
  "keywords": [
6
6
  "whatsapp",