whalibmob 5.5.77 → 5.5.80

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.
@@ -693,52 +693,50 @@ class MessageSender {
693
693
  // they simply omit the device-identity node (server accepts this for primaries).
694
694
  const allowPkmsg = true;
695
695
 
696
- // First, run the phone-based usync (and own devices) in parallel.
697
- // IMPORTANT: _pnToLid may be empty RIGHT NOW but gets populated during this
698
- // await — incoming messages from the recipient (which arrive while we wait
699
- // for the usync timeout) tell us their LID JID via from=LID + sender_pn attrs.
700
- // We therefore check _pnToLid AFTER this await, not before.
696
+ // Enumerate the recipient's devices and our own in parallel — Baileys does
697
+ // the same in one getUSyncDevices([senderIdentity, jid]) call.
701
698
  const [_recipientDevicesByPhone, ownDevices] = await Promise.all([
702
699
  this._devMgr.bulkEnsureSessions([recipientPhone], this._signal, allowPkmsg),
703
700
  this._devMgr.ensureOwnDeviceSessions(ownPhone, this._signal, allowPkmsg)
704
701
  ]);
705
702
 
706
- // ── LID routing fix ───────────────────────────────────────────────────────
707
- // Check _pnToLid NOW — after the await above, incoming messages from the
708
- // recipient during the usync wait will have populated this map.
709
- // For LID-migrated accounts, the message `to` field AND Signal participants
710
- // must use the LID JID. Phone-JID messages are silently accepted by the
711
- // server but never delivered to the recipient's LID-registered device.
703
+ // ── Addressing family ─────────────────────────────────────────────────────
704
+ // Baileys 7.0.0-rc13 — the release that fixed ack 479 on LID addressing —
705
+ // derives the whole address family from the JID the caller passed, and
706
+ // never converts between the two:
712
707
  //
713
- // WA_DM_ROUTE overrides the choice for diagnosis, because both routes have
714
- // been observed failing in different ways and only a live account can tell
715
- // them apart:
716
- // pn — always address the phone JID (how this worked before LID JIDs
717
- // started being decoded at all)
718
- // lid — always address the LID when one is known (the default below)
719
- // auto — same as lid; the default
720
- const routeMode = (process.env.WA_DM_ROUTE || 'auto').toLowerCase();
721
- const lidUser = this._client._pnToLid && this._client._pnToLid.get(recipientPhone);
722
- const useLidRoute = lidUser && routeMode !== 'pn';
723
- const routingToJid = useLidRoute ? `${lidUser}@lid` : toJid;
724
-
725
- _whaDbg('[DBG] DM_ROUTE phone=' + recipientPhone +
726
- ' routing=' + routingToJid + (useLidRoute ? ' (LID)' : ' (PN)') +
727
- ' mode=' + routeMode);
708
+ // const targetUserServer = isLid ? 'lid' : 's.whatsapp.net'
709
+ // const senderIdentity = isLid && meLid ? <ourLid> : <ourPn>
710
+ // const sessionDevices = await getUSyncDevices([senderIdentity, jid])
711
+ // const finalJid = jid // the envelope, unchanged
712
+ //
713
+ // Send to a phone JID and everything — envelope, device enumeration,
714
+ // participant <to> entries — stays on phone JIDs. Send to an @lid and it
715
+ // all stays LID.
716
+ //
717
+ // This used to look the recipient up in _pnToLid and rewrite a
718
+ // phone-addressed DM into a LID-addressed one, on the reasoning that a
719
+ // phone-addressed message is accepted but never delivered to a
720
+ // LID-registered device. That rewrite is what produced the 479s: every
721
+ // rejected stanza in the traces carried to="...@lid", and both
722
+ // whatsmeow #859 and the Baileys LID reports describe the ack as appearing
723
+ // specifically on @lid-addressed sends. Following the caller's JID removes
724
+ // the mismatch instead of trying to compensate for it.
725
+ const isLidTarget = toJid.endsWith('@lid');
726
+ const routingToJid = toJid;
728
727
 
729
728
  let otherJids;
730
- // Follow the same address family as the routing JID — the participants and
731
- // the `to` must agree, so WA_DM_ROUTE=pn has to switch both.
732
- if (useLidRoute) {
733
- // Fetch bundle + build Signal session for the LID JID.
734
- // skipUsync=true: we already know the LID from _pnToLid — skip a second
735
- // 15 s usync round-trip and go straight to bundle fetch (device 0 primary).
729
+ if (isLidTarget) {
730
+ const lidUser = phoneFromJid(toJid);
736
731
  const lidDevices = await this._devMgr.bulkEnsureSessionsForLid(
737
732
  lidUser, this._signal, allowPkmsg, /* skipUsync */ true);
738
- otherJids = lidDevices.length > 0 ? lidDevices : [routingToJid];
733
+ otherJids = lidDevices.length > 0 ? lidDevices : [toJid];
739
734
  } else {
740
735
  otherJids = _recipientDevicesByPhone.length > 0 ? _recipientDevicesByPhone : [toJid];
741
736
  }
737
+
738
+ _whaDbg('[DBG] DM_ROUTE to=' + toJid + ' family=' + (isLidTarget ? 'LID' : 'PN') +
739
+ ' devices=[' + otherJids.join(',') + ']');
742
740
  // ─────────────────────────────────────────────────────────────────────────
743
741
 
744
742
  const ownLinkedJids = ownDevices.filter(j => j !== ownMainJid);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whalibmob",
3
- "version": "5.5.77",
3
+ "version": "5.5.80",
4
4
  "description": "WhatsApp library for interaction with WhatsApp Mobile API no web",
5
5
  "author": "Kunboruto50",
6
6
  "main": "index.js",