whalibmob 5.5.80 → 5.5.81

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.
@@ -718,7 +718,7 @@ class DeviceManager {
718
718
  // 2. Establishes Signal sessions for LID device JIDs (e.g. 139471160877194:0@lid)
719
719
  // 3. Returns the list of ready LID device JIDs for participant fanout
720
720
  //
721
- async bulkEnsureSessionsForLid(lidUser, signalProto, allowPkmsg = true, skipUsync = false) {
721
+ async bulkEnsureSessionsForLid(lidUser, signalProto, allowPkmsg = true, skipUsync = false, _isRetry = false) {
722
722
  const lidJid = `${lidUser}@lid`;
723
723
  const cacheKey = `lid:${lidUser}`;
724
724
 
@@ -812,6 +812,27 @@ class DeviceManager {
812
812
  }
813
813
  }
814
814
 
815
+ // Every enumerated device must end up with a session, because every one of
816
+ // them becomes a <to><enc> entry. Coming up short means the cached device
817
+ // list no longer matches the account: a device that has since been unlinked
818
+ // is still listed, the server has no bundle for it, and the stanza goes out
819
+ // missing an entry the server still expects — which it rejects with ack 479.
820
+ //
821
+ // Seen exactly that way in a live trace: five devices enumerated from cache
822
+ // (0, 49, 51, 55, 57), four bundles returned, device 51 left without a
823
+ // session, four participants sent, 479 back.
824
+ //
825
+ // Drop the stale list and re-enumerate once, so the participants match what
826
+ // the server currently believes the account has.
827
+ if (readyJids.length < deviceJids.length && !_isRetry) {
828
+ _whaDbg('[DBG] LID_DEVICE_LIST_STALE lidUser=' + lidUser +
829
+ ' enumerated=' + deviceJids.length + ' sessions=' + readyJids.length +
830
+ ' — re-running usync\n');
831
+ this._dcDel([cacheKey]);
832
+ return this.bulkEnsureSessionsForLid(
833
+ lidUser, signalProto, allowPkmsg, /* skipUsync */ false, /* _isRetry */ true);
834
+ }
835
+
815
836
  // Fallback: use primary LID device 0 directly (no session yet, will use pkmsg)
816
837
  if (readyJids.length === 0) {
817
838
  readyJids.push(makeDeviceJid(lidUser, 0, 'lid'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whalibmob",
3
- "version": "5.5.80",
3
+ "version": "5.5.81",
4
4
  "description": "WhatsApp library for interaction with WhatsApp Mobile API no web",
5
5
  "author": "Kunboruto50",
6
6
  "main": "index.js",