whalibmob 5.10.7 → 5.10.8

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.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/lib/Client.js +12 -14
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2168,6 +2168,12 @@ await client.changeGroupPicture('120363000000000000@g.us', null)
2168
2168
  `changeGroupPicture` throws when the server refuses — `406` for an image it will
2169
2169
  not take, `403` when you are not an admin of that group.
2170
2170
 
2171
+ > [!NOTE]
2172
+ > The two are addressed differently, and it matters. A group picture names the
2173
+ > group in the IQ's `target`; your own picture names nobody — the server takes
2174
+ > that from the session. Your own JID in `target` is not an error the server
2175
+ > reports, it is a stanza it drops without answering.
2176
+
2171
2177
  **Both calls re-encode the image before sending it.** WhatsApp wants a square
2172
2178
  640×640 JPEG, and a picture that is not one is *dropped without an answer*
2173
2179
  rather than refused — so an unprepared file fails as a timeout that looks like a
package/lib/Client.js CHANGED
@@ -4339,26 +4339,24 @@ class WhalibmobClient extends EventEmitter {
4339
4339
  // naturally tries and what the server silently drops — pass { raw: true } to
4340
4340
  // skip that if you have already prepared it yourself.
4341
4341
  //
4342
- // The picture is not addressed by sending the IQ *to* yourself: it goes to
4343
- // the server with the account named in `target`, the same shape a group
4344
- // picture uses. Addressed the other way the server files it nowhere and never
4345
- // answers, which looked from the outside like the picture had been set — the
4346
- // stanza went out, nothing came back, and nothing checked.
4342
+ // `target` names *whose* picture is being set, and is left off entirely when
4343
+ // it is your own — the server infers that from the session. A group picture
4344
+ // carries a target and works; the same IQ with your own JID in target does
4345
+ // not, and the server's answer to that is silence rather than a refusal.
4346
+ //
4347
+ // This has now been wrong in both directions: first addressed *to* the
4348
+ // account, then addressed about it. It is neither — it is addressed to the
4349
+ // server with nothing named at all.
4347
4350
  async changeProfilePicture(buf, opts) {
4348
4351
  if (!this._store) throw new Error('Not connected');
4349
4352
  opts = opts || {};
4350
- const selfJid = this._ownDeviceJid
4351
- ? toNonAdJid(this._ownDeviceJid())
4352
- : `${this._store.phoneNumber}@s.whatsapp.net`;
4353
-
4354
4353
  const picture = (buf && !opts.raw) ? await prepareProfilePicture(buf, opts) : buf;
4355
4354
 
4356
4355
  const node = new BinaryNode('iq', {
4357
- id: this._genMsgId(),
4358
- xmlns: 'w:profile:picture',
4359
- to: 's.whatsapp.net',
4360
- target: jidStrToObj(selfJid),
4361
- type: 'set'
4356
+ id: this._genMsgId(),
4357
+ xmlns: 'w:profile:picture',
4358
+ to: 's.whatsapp.net',
4359
+ type: 'set'
4362
4360
  }, picture ? [new BinaryNode('picture', { type: 'image' }, picture)] : null);
4363
4361
 
4364
4362
  const resp = await this._sendIq(node);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whalibmob",
3
- "version": "5.10.7",
3
+ "version": "5.10.8",
4
4
  "description": "WhatsApp library for interaction with WhatsApp Mobile API no web",
5
5
  "author": "Kunboruto20",
6
6
  "main": "index.js",