lordceaser-baileys 3.4.0 → 3.4.2
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.
- package/LICENSE +22 -0
- package/README.md +201 -0
- package/WAProto/_orig.js +92429 -277359
- package/WAProto/index.d.ts +11659 -95047
- package/WAProto/index.js +5 -2
- package/banner.png +0 -0
- package/index.js +11 -6
- package/lib/Defaults/index.d.ts +118 -48
- package/lib/Defaults/index.d.ts.map +1 -1
- package/lib/Defaults/index.js +29 -6
- package/lib/Defaults/index.js.map +1 -1
- package/lib/Signal/Group/ciphertext-message.d.ts +8 -8
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -1
- package/lib/Signal/Group/ciphertext-message.js.map +1 -1
- package/lib/Signal/Group/group-session-builder.d.ts +6 -13
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -1
- package/lib/Signal/Group/group-session-builder.js.map +1 -1
- package/lib/Signal/Group/group_cipher.d.ts +9 -15
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -1
- package/lib/Signal/Group/group_cipher.js.map +1 -1
- package/lib/Signal/Group/index.d.ts +11 -11
- package/lib/Signal/Group/index.d.ts.map +1 -1
- package/lib/Signal/Group/index.js.map +1 -1
- package/lib/Signal/Group/keyhelper.d.ts +6 -10
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -1
- package/lib/Signal/Group/keyhelper.js.map +1 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +10 -10
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -1
- package/lib/Signal/Group/sender-chain-key.js.map +1 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +14 -14
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -1
- package/lib/Signal/Group/sender-key-message.d.ts +16 -16
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -1
- package/lib/Signal/Group/sender-key-message.js.map +1 -1
- package/lib/Signal/Group/sender-key-name.d.ts +7 -13
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -1
- package/lib/Signal/Group/sender-key-name.js.map +1 -1
- package/lib/Signal/Group/sender-key-record.d.ts +10 -28
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -1
- package/lib/Signal/Group/sender-key-record.js.map +1 -1
- package/lib/Signal/Group/sender-key-state.d.ts +14 -36
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -1
- package/lib/Signal/Group/sender-key-state.js.map +1 -1
- package/lib/Signal/Group/sender-message-key.d.ts +10 -10
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -1
- package/lib/Signal/Group/sender-message-key.js.map +1 -1
- package/lib/Signal/libsignal.d.ts +54 -4
- package/lib/Signal/libsignal.d.ts.map +1 -1
- package/lib/Signal/libsignal.js.map +1 -1
- package/lib/Signal/lid-mapping.d.ts +15 -17
- package/lib/Signal/lid-mapping.d.ts.map +1 -1
- package/lib/Signal/lid-mapping.js.map +1 -1
- package/lib/Socket/Client/index.d.ts +2 -2
- package/lib/Socket/Client/index.d.ts.map +1 -1
- package/lib/Socket/Client/index.js +1 -0
- package/lib/Socket/Client/index.js.map +1 -1
- package/lib/Socket/Client/types.d.ts +4 -14
- package/lib/Socket/Client/types.d.ts.map +1 -1
- package/lib/Socket/Client/types.js +2 -1
- package/lib/Socket/Client/types.js.map +1 -1
- package/lib/Socket/Client/websocket.d.ts +5 -5
- package/lib/Socket/Client/websocket.d.ts.map +1 -1
- package/lib/Socket/Client/websocket.js +2 -1
- package/lib/Socket/Client/websocket.js.map +1 -1
- package/lib/Socket/business.d.ts +353 -175
- package/lib/Socket/business.d.ts.map +1 -1
- package/lib/Socket/business.js +43 -70
- package/lib/Socket/business.js.map +1 -1
- package/lib/Socket/chats.d.ts +112 -93
- package/lib/Socket/chats.d.ts.map +1 -1
- package/lib/Socket/chats.js +20 -709
- package/lib/Socket/chats.js.map +1 -1
- package/lib/Socket/communities.d.ts +499 -210
- package/lib/Socket/communities.d.ts.map +1 -1
- package/lib/Socket/communities.js +1 -0
- package/lib/Socket/communities.js.map +1 -1
- package/lib/Socket/groups.d.ts +245 -120
- package/lib/Socket/groups.d.ts.map +1 -1
- package/lib/Socket/groups.js +5 -206
- package/lib/Socket/groups.js.map +1 -1
- package/lib/Socket/index.d.ts +478 -208
- package/lib/Socket/index.d.ts.map +1 -1
- package/lib/Socket/index.js +3 -28
- package/lib/Socket/index.js.map +1 -1
- package/lib/Socket/messages-recv.d.ts +295 -164
- package/lib/Socket/messages-recv.d.ts.map +1 -1
- package/lib/Socket/messages-recv.js +9 -381
- package/lib/Socket/messages-recv.js.map +1 -1
- package/lib/Socket/messages-send.d.ts +290 -159
- package/lib/Socket/messages-send.d.ts.map +1 -1
- package/lib/Socket/messages-send.js +154 -1963
- package/lib/Socket/messages-send.js.map +1 -1
- package/lib/Socket/mex.d.ts +1 -2
- package/lib/Socket/mex.d.ts.map +1 -1
- package/lib/Socket/mex.js +2 -1
- package/lib/Socket/mex.js.map +1 -1
- package/lib/Socket/newsletter.d.ts +251 -138
- package/lib/Socket/newsletter.d.ts.map +1 -1
- package/lib/Socket/newsletter.js +9 -43
- package/lib/Socket/newsletter.js.map +1 -1
- package/lib/Socket/socket.d.ts +44 -42
- package/lib/Socket/socket.d.ts.map +1 -1
- package/lib/Socket/socket.js +17 -64
- package/lib/Socket/socket.js.map +1 -1
- package/lib/Store/index.d.ts +4 -0
- package/lib/Store/index.d.ts.map +1 -0
- package/lib/Store/index.js +4 -0
- package/lib/Store/index.js.map +1 -0
- package/lib/Store/make-in-memory-store.d.ts +63 -0
- package/lib/Store/make-in-memory-store.d.ts.map +1 -0
- package/lib/Store/make-in-memory-store.js +421 -0
- package/lib/Store/make-in-memory-store.js.map +1 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.d.ts.map +1 -0
- package/lib/Store/make-ordered-dictionary.js +79 -0
- package/lib/Store/make-ordered-dictionary.js.map +1 -0
- package/lib/Store/object-repository.d.ts +11 -0
- package/lib/Store/object-repository.d.ts.map +1 -0
- package/lib/Store/object-repository.js +24 -0
- package/lib/Store/object-repository.js.map +1 -0
- package/lib/Types/Auth.d.ts +0 -115
- package/lib/Types/Auth.d.ts.map +1 -1
- package/lib/Types/Auth.js.map +1 -1
- package/lib/Types/Bussines.d.ts +1 -24
- package/lib/Types/Bussines.d.ts.map +1 -1
- package/lib/Types/Bussines.js.map +1 -1
- package/lib/Types/Call.d.ts +1 -14
- package/lib/Types/Call.d.ts.map +1 -1
- package/lib/Types/Call.js.map +1 -1
- package/lib/Types/Chat.d.ts +1 -123
- package/lib/Types/Chat.d.ts.map +1 -1
- package/lib/Types/Chat.js.map +1 -1
- package/lib/Types/Contact.d.ts +1 -25
- package/lib/Types/Contact.d.ts.map +1 -1
- package/lib/Types/Contact.js.map +1 -1
- package/lib/Types/Events.d.ts +1 -255
- package/lib/Types/Events.d.ts.map +1 -1
- package/lib/Types/Events.js.map +1 -1
- package/lib/Types/GroupMetadata.d.ts +1 -70
- package/lib/Types/GroupMetadata.d.ts.map +1 -1
- package/lib/Types/GroupMetadata.js.map +1 -1
- package/lib/Types/Label.d.ts +1 -45
- package/lib/Types/Label.d.ts.map +1 -1
- package/lib/Types/Label.js.map +1 -1
- package/lib/Types/LabelAssociation.d.ts +1 -28
- package/lib/Types/LabelAssociation.d.ts.map +1 -1
- package/lib/Types/LabelAssociation.js.map +1 -1
- package/lib/Types/Message.d.ts +10 -318
- package/lib/Types/Message.d.ts.map +1 -1
- package/lib/Types/Message.js +7 -0
- package/lib/Types/Message.js.map +1 -1
- package/lib/Types/Mex.d.ts +2 -140
- package/lib/Types/Mex.d.ts.map +1 -1
- package/lib/Types/Mex.js +2 -0
- package/lib/Types/Mex.js.map +1 -1
- package/lib/Types/Product.d.ts +1 -78
- package/lib/Types/Product.d.ts.map +1 -1
- package/lib/Types/Product.js.map +1 -1
- package/lib/Types/RichType.d.ts +3 -0
- package/lib/Types/RichType.d.ts.map +1 -0
- package/lib/Types/RichType.js +23 -0
- package/lib/Types/RichType.js.map +1 -0
- package/lib/Types/Signal.d.ts +0 -85
- package/lib/Types/Signal.d.ts.map +1 -1
- package/lib/Types/Signal.js.map +1 -1
- package/lib/Types/Socket.d.ts +1 -135
- package/lib/Types/Socket.d.ts.map +1 -1
- package/lib/Types/Socket.js +0 -1
- package/lib/Types/Socket.js.map +1 -1
- package/lib/Types/State.d.ts +5 -96
- package/lib/Types/State.d.ts.map +1 -1
- package/lib/Types/State.js.map +1 -1
- package/lib/Types/USync.d.ts +1 -25
- package/lib/Types/USync.d.ts.map +1 -1
- package/lib/Types/USync.js.map +1 -1
- package/lib/Types/index.d.ts +13 -65
- package/lib/Types/index.d.ts.map +1 -1
- package/lib/Types/index.js.map +1 -1
- package/lib/Utils/auth-utils.d.ts +51 -17
- package/lib/Utils/auth-utils.d.ts.map +1 -1
- package/lib/Utils/auth-utils.js +5 -1
- package/lib/Utils/auth-utils.js.map +1 -1
- package/lib/Utils/browser-utils.d.ts +9 -3
- package/lib/Utils/browser-utils.d.ts.map +1 -1
- package/lib/Utils/browser-utils.js.map +1 -1
- package/lib/Utils/business.d.ts +46 -19
- package/lib/Utils/business.d.ts.map +1 -1
- package/lib/Utils/business.js.map +1 -1
- package/lib/Utils/chat-utils.d.ts +398 -89
- package/lib/Utils/chat-utils.d.ts.map +1 -1
- package/lib/Utils/chat-utils.js.map +1 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -16
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -1
- package/lib/Utils/companion-reg-client-utils.js +7 -2
- package/lib/Utils/companion-reg-client-utils.js.map +1 -1
- package/lib/Utils/crypto.d.ts +29 -26
- package/lib/Utils/crypto.d.ts.map +1 -1
- package/lib/Utils/crypto.js +2 -0
- package/lib/Utils/crypto.js.map +1 -1
- package/lib/Utils/decode-wa-message.d.ts +76 -58
- package/lib/Utils/decode-wa-message.d.ts.map +1 -1
- package/lib/Utils/decode-wa-message.js.map +1 -1
- package/lib/Utils/event-buffer.d.ts +9 -32
- package/lib/Utils/event-buffer.d.ts.map +1 -1
- package/lib/Utils/event-buffer.js.map +1 -1
- package/lib/Utils/generics.d.ts +45 -73
- package/lib/Utils/generics.d.ts.map +1 -1
- package/lib/Utils/generics.js +17 -15
- package/lib/Utils/generics.js.map +1 -1
- package/lib/Utils/history.d.ts +73 -21
- package/lib/Utils/history.d.ts.map +1 -1
- package/lib/Utils/history.js.map +1 -1
- package/lib/Utils/identity-change-handler.d.ts +9 -39
- package/lib/Utils/identity-change-handler.d.ts.map +1 -1
- package/lib/Utils/identity-change-handler.js.map +1 -1
- package/lib/Utils/index.d.ts +24 -21
- package/lib/Utils/index.d.ts.map +1 -1
- package/lib/Utils/index.js +3 -0
- package/lib/Utils/index.js.map +1 -1
- package/lib/Utils/link-preview.d.ts +8 -16
- package/lib/Utils/link-preview.d.ts.map +1 -1
- package/lib/Utils/link-preview.js.map +1 -1
- package/lib/Utils/logger.d.ts +1 -10
- package/lib/Utils/logger.d.ts.map +1 -1
- package/lib/Utils/logger.js.map +1 -1
- package/lib/Utils/lt-hash.d.ts +1 -2
- package/lib/Utils/lt-hash.d.ts.map +1 -1
- package/lib/Utils/lt-hash.js.map +1 -1
- package/lib/Utils/make-mutex.d.ts +4 -6
- package/lib/Utils/make-mutex.d.ts.map +1 -1
- package/lib/Utils/make-mutex.js.map +1 -1
- package/lib/Utils/message-retry-manager.d.ts +36 -71
- package/lib/Utils/message-retry-manager.d.ts.map +1 -1
- package/lib/Utils/message-retry-manager.js +1 -1
- package/lib/Utils/message-retry-manager.js.map +1 -1
- package/lib/Utils/messages-media.d.ts +121 -117
- package/lib/Utils/messages-media.d.ts.map +1 -1
- package/lib/Utils/messages-media.js +87 -32
- package/lib/Utils/messages-media.js.map +1 -1
- package/lib/Utils/messages.d.ts +33 -78
- package/lib/Utils/messages.d.ts.map +1 -1
- package/lib/Utils/messages.js +1010 -63
- package/lib/Utils/messages.js.map +1 -1
- package/lib/Utils/noise-handler.d.ts +18 -17
- package/lib/Utils/noise-handler.d.ts.map +1 -1
- package/lib/Utils/noise-handler.js.map +1 -1
- package/lib/Utils/offline-node-processor.d.ts +2 -9
- package/lib/Utils/offline-node-processor.d.ts.map +1 -1
- package/lib/Utils/offline-node-processor.js.map +1 -1
- package/lib/Utils/pre-key-manager.d.ts +9 -11
- package/lib/Utils/pre-key-manager.d.ts.map +1 -1
- package/lib/Utils/pre-key-manager.js.map +1 -1
- package/lib/Utils/process-message.d.ts +70 -46
- package/lib/Utils/process-message.d.ts.map +1 -1
- package/lib/Utils/process-message.js +119 -0
- package/lib/Utils/process-message.js.map +1 -1
- package/lib/Utils/reporting-utils.d.ts +12 -10
- package/lib/Utils/reporting-utils.d.ts.map +1 -1
- package/lib/Utils/reporting-utils.js.map +1 -1
- package/lib/Utils/rich-message-utils.d.ts +49 -0
- package/lib/Utils/rich-message-utils.d.ts.map +1 -0
- package/lib/Utils/rich-message-utils.js +370 -0
- package/lib/Utils/rich-message-utils.js.map +1 -0
- package/lib/Utils/signal.d.ts +71 -35
- package/lib/Utils/signal.d.ts.map +1 -1
- package/lib/Utils/signal.js.map +1 -1
- package/lib/Utils/stanza-ack.d.ts +8 -2
- package/lib/Utils/stanza-ack.d.ts.map +1 -1
- package/lib/Utils/stanza-ack.js.map +1 -1
- package/lib/Utils/sync-action-utils.d.ts +2 -18
- package/lib/Utils/sync-action-utils.d.ts.map +1 -1
- package/lib/Utils/sync-action-utils.js.map +1 -1
- package/lib/Utils/tc-token-utils.d.ts +23 -30
- package/lib/Utils/tc-token-utils.d.ts.map +1 -1
- package/lib/Utils/tc-token-utils.js.map +1 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts +9 -11
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -1
- package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-single-file-auth-state.js +109 -0
- package/lib/Utils/use-single-file-auth-state.js.map +1 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-sqlite-auth-state.js +109 -0
- package/lib/Utils/use-sqlite-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +42 -9
- package/lib/Utils/validate-connection.d.ts.map +1 -1
- package/lib/Utils/validate-connection.js.map +1 -1
- package/lib/WABinary/constants.d.ts +60 -26
- package/lib/WABinary/constants.d.ts.map +1 -1
- package/lib/WABinary/constants.js +166 -0
- package/lib/WABinary/constants.js.map +1 -1
- package/lib/WABinary/decode.d.ts +8 -5
- package/lib/WABinary/decode.d.ts.map +1 -1
- package/lib/WABinary/decode.js.map +1 -1
- package/lib/WABinary/encode.d.ts +2 -2
- package/lib/WABinary/encode.d.ts.map +1 -1
- package/lib/WABinary/encode.js.map +1 -1
- package/lib/WABinary/generic-utils.d.ts +75 -13
- package/lib/WABinary/generic-utils.d.ts.map +1 -1
- package/lib/WABinary/generic-utils.js +114 -1
- package/lib/WABinary/generic-utils.js.map +1 -1
- package/lib/WABinary/index.d.ts +5 -5
- package/lib/WABinary/index.d.ts.map +1 -1
- package/lib/WABinary/index.js.map +1 -1
- package/lib/WABinary/jid-utils.d.ts +28 -47
- package/lib/WABinary/jid-utils.d.ts.map +1 -1
- package/lib/WABinary/jid-utils.js +1 -1
- package/lib/WABinary/jid-utils.js.map +1 -1
- package/lib/WABinary/types.d.ts +1 -18
- package/lib/WABinary/types.d.ts.map +1 -1
- package/lib/WABinary/types.js.map +1 -1
- package/lib/WAM/BinaryInfo.d.ts +4 -5
- package/lib/WAM/BinaryInfo.d.ts.map +1 -1
- package/lib/WAM/BinaryInfo.js.map +1 -1
- package/lib/WAM/constants.d.ts +34916 -29
- package/lib/WAM/constants.d.ts.map +1 -1
- package/lib/WAM/constants.js.map +1 -1
- package/lib/WAM/encode.d.ts +1 -2
- package/lib/WAM/encode.d.ts.map +1 -1
- package/lib/WAM/encode.js.map +1 -1
- package/lib/WAM/index.d.ts +3 -3
- package/lib/WAM/index.d.ts.map +1 -1
- package/lib/WAM/index.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +34 -7
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -7
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +20 -20
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +2 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +2 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +7 -7
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +3 -2
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +36 -23
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +2 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +12 -7
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +2 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -1
- package/lib/WAUSync/Protocols/index.d.ts +5 -5
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -1
- package/lib/WAUSync/Protocols/index.js +1 -7
- package/lib/WAUSync/Protocols/index.js.map +1 -1
- package/lib/WAUSync/USyncQuery.d.ts +10 -19
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -1
- package/lib/WAUSync/USyncQuery.js +23 -126
- package/lib/WAUSync/USyncQuery.js.map +1 -1
- package/lib/WAUSync/USyncUser.d.ts +15 -15
- package/lib/WAUSync/USyncUser.d.ts.map +1 -1
- package/lib/WAUSync/USyncUser.js +1 -24
- package/lib/WAUSync/USyncUser.js.map +1 -1
- package/lib/WAUSync/index.d.ts +3 -3
- package/lib/WAUSync/index.d.ts.map +1 -1
- package/lib/WAUSync/index.js +2 -1
- package/lib/WAUSync/index.js.map +1 -1
- package/lib/index.d.ts +9 -9
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +11 -3
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/V +0 -1
- package/WAProto/WAProto.proto +0 -8423
- package/WAProto/fix-imports.js +0 -85
- package/lib/Socket/aigroups.js +0 -315
- package/lib/Socket/ban-checker.js +0 -153
- package/lib/Socket/chats.js[old] +0 -1227
- package/lib/Socket/graphql.js +0 -899
- package/lib/Socket/groups.js[old] +0 -347
- package/lib/Socket/interactive-handler.js +0 -600
- package/lib/Socket/interop.js +0 -563
- package/lib/Socket/managed-account.js +0 -208
- package/lib/Socket/package.json +0 -1
- package/lib/Socket/privacy.js +0 -446
- package/lib/Socket/registration.js +0 -428
- package/lib/Socket/username.js +0 -229
- package/lib/Utils/package.json +0 -1
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +0 -96
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +0 -70
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +0 -28
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +0 -25
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +0 -34
- package/lib/package.json +0 -1
package/lib/Socket/chats.js
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import NodeCache from '@cacheable/node-cache';
|
|
2
2
|
import { Boom } from '@hapi/boom';
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
|
-
import { DEFAULT_CACHE_TTLS, HISTORY_SYNC_PAUSED_TIMEOUT_MS, PROCESSABLE_HISTORY_TYPES
|
|
4
|
+
import { DEFAULT_CACHE_TTLS, HISTORY_SYNC_PAUSED_TIMEOUT_MS, PROCESSABLE_HISTORY_TYPES } from '../Defaults/index.js';
|
|
5
5
|
import { ALL_WA_PATCH_NAMES } from '../Types/index.js';
|
|
6
6
|
import { SyncState } from '../Types/State.js';
|
|
7
|
-
import { chatModificationToAppPatch,
|
|
8
|
-
import { generateProfilePictureHD } from '../Utils/messages-media.js';
|
|
7
|
+
import { chatModificationToAppPatch, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, ensureLTHashStateVersion, extractSyncdPatches, generateProfilePicture, getHistoryMsg, isAppStateSyncIrrecoverable, isMissingKeyError, MAX_SYNC_ATTEMPTS, newLTHashState, processSyncAction } from '../Utils/index.js';
|
|
9
8
|
import { makeMutex } from '../Utils/make-mutex.js';
|
|
10
9
|
import processMessage from '../Utils/process-message.js';
|
|
11
10
|
import { buildTcTokenFromJid } from '../Utils/tc-token-utils.js';
|
|
12
|
-
import { getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser,
|
|
11
|
+
import { getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
13
12
|
import { USyncQuery, USyncUser } from '../WAUSync/index.js';
|
|
14
13
|
import { makeSocket } from './socket.js';
|
|
14
|
+
export const buildProfilePictureQueryContent = (type, tcTokenContent) => {
|
|
15
|
+
const picture = { tag: 'picture', attrs: { type, query: 'url' } };
|
|
16
|
+
if (tcTokenContent?.length) {
|
|
17
|
+
picture.content = tcTokenContent;
|
|
18
|
+
}
|
|
19
|
+
return [picture];
|
|
20
|
+
};
|
|
15
21
|
export const makeChatsSocket = (config) => {
|
|
16
22
|
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, getMessage } = config;
|
|
17
23
|
const sock = makeSocket(config);
|
|
18
24
|
const { ev, ws, authState, generateMessageTag, sendNode, query, signalRepository, onUnexpectedError, sendUnifiedSession, registerSocketEndHandler } = sock;
|
|
19
25
|
const getLIDForPN = signalRepository.lidMapping.getLIDForPN.bind(signalRepository.lidMapping);
|
|
20
|
-
// Cache newsletter messageId → server_id so quoted posts can be enriched later
|
|
21
|
-
const _nlServerIdCache = new Map();
|
|
22
26
|
let privacySettings;
|
|
23
27
|
/** Server-assigned AB props for protocol behavior. */
|
|
24
28
|
const serverProps = {
|
|
@@ -139,609 +143,6 @@ export const makeChatsSocket = (config) => {
|
|
|
139
143
|
]
|
|
140
144
|
});
|
|
141
145
|
};
|
|
142
|
-
const getStatusPrivacy = async () => {
|
|
143
|
-
const result = await query({
|
|
144
|
-
tag: 'iq',
|
|
145
|
-
attrs: {
|
|
146
|
-
xmlns: 'status',
|
|
147
|
-
to: S_WHATSAPP_NET,
|
|
148
|
-
type: 'get'
|
|
149
|
-
},
|
|
150
|
-
content: [{ tag: 'privacy', attrs: {} }]
|
|
151
|
-
});
|
|
152
|
-
const privacyNode = result?.content?.[0];
|
|
153
|
-
if (!privacyNode)
|
|
154
|
-
return null;
|
|
155
|
-
const lists = [];
|
|
156
|
-
for (const listNode of privacyNode.content || []) {
|
|
157
|
-
const { type, id, listname, emoji, selected, deleted } = listNode.attrs || {};
|
|
158
|
-
const members = (listNode.content || []).map(u => u.attrs?.jid).filter(Boolean);
|
|
159
|
-
lists.push({ type, id, listname, emoji, selected: selected === 'true', deleted: deleted === 'true', members });
|
|
160
|
-
}
|
|
161
|
-
return lists;
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* Set status privacy via `xmlns="status"` IQ SET.
|
|
165
|
-
* Supports simple distribution types and contact-level whitelist/blacklist/customlist.
|
|
166
|
-
*
|
|
167
|
-
* @param {'contacts'|'whitelist'|'blacklist'|'null'} type - Distribution type
|
|
168
|
-
* @param {string[]} [jids] - JIDs for the list (whitelist/blacklist)
|
|
169
|
-
* @param {Array<{id: string, listname: string, emoji?: string, selected?: boolean, deleted?: boolean, members?: string[]}>} [customLists]
|
|
170
|
-
*/
|
|
171
|
-
const setStatusPrivacy = async (type, jids = [], customLists = []) => {
|
|
172
|
-
const content = [];
|
|
173
|
-
// main distribution list
|
|
174
|
-
const mainList = {
|
|
175
|
-
tag: 'list',
|
|
176
|
-
attrs: { type },
|
|
177
|
-
content: jids.map(jid => ({ tag: 'user', attrs: { jid }, content: [] }))
|
|
178
|
-
};
|
|
179
|
-
content.push(mainList);
|
|
180
|
-
// custom named lists
|
|
181
|
-
for (const cl of customLists) {
|
|
182
|
-
const attrs = { type: 'customlist', id: cl.id, listname: cl.listname };
|
|
183
|
-
if (cl.emoji)
|
|
184
|
-
attrs.emoji = cl.emoji;
|
|
185
|
-
if (cl.selected)
|
|
186
|
-
attrs.selected = 'true';
|
|
187
|
-
if (cl.deleted)
|
|
188
|
-
attrs.deleted = 'true';
|
|
189
|
-
content.push({
|
|
190
|
-
tag: 'list',
|
|
191
|
-
attrs,
|
|
192
|
-
content: (cl.members || []).map(jid => ({ tag: 'user', attrs: { jid }, content: [] }))
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
await query({
|
|
196
|
-
tag: 'iq',
|
|
197
|
-
attrs: {
|
|
198
|
-
xmlns: 'status',
|
|
199
|
-
to: S_WHATSAPP_NET,
|
|
200
|
-
type: 'set'
|
|
201
|
-
},
|
|
202
|
-
content: [{ tag: 'privacy', attrs: {}, content }]
|
|
203
|
-
});
|
|
204
|
-
};
|
|
205
|
-
/**
|
|
206
|
-
* Fetch broadcast list quota from the server (xmlns="w:biz").
|
|
207
|
-
*
|
|
208
|
-
* Returns: { messagesLeft, totalLimit, isHeavySender, startTs, endTs, resetTs }
|
|
209
|
-
*/
|
|
210
|
-
const fetchBroadcastListQuota = async () => {
|
|
211
|
-
const result = await query({
|
|
212
|
-
tag: 'iq',
|
|
213
|
-
attrs: {
|
|
214
|
-
xmlns: 'w:biz',
|
|
215
|
-
to: S_WHATSAPP_NET,
|
|
216
|
-
type: 'get'
|
|
217
|
-
},
|
|
218
|
-
content: [{ tag: 'broadcast_list_quota', attrs: {}, content: [] }]
|
|
219
|
-
}, 32000);
|
|
220
|
-
const limitsNode = getBinaryNodeChild(result, 'limits');
|
|
221
|
-
const timeframeNode = getBinaryNodeChild(result, 'timeframe');
|
|
222
|
-
if (!limitsNode)
|
|
223
|
-
return null;
|
|
224
|
-
return {
|
|
225
|
-
messagesLeft: parseInt(limitsNode.attrs?.messages_left ?? getBinaryNodeChild(limitsNode, 'messages_left')?.content ?? '0', 10),
|
|
226
|
-
totalLimit: parseInt(limitsNode.attrs?.total_limit ?? getBinaryNodeChild(limitsNode, 'total_limit')?.content ?? '0', 10),
|
|
227
|
-
isHeavySender: (limitsNode.attrs?.is_heavy_sender ?? getBinaryNodeChild(limitsNode, 'is_heavy_sender')?.content) === 'true',
|
|
228
|
-
startTs: parseInt(timeframeNode?.attrs?.start_ts_s ?? getBinaryNodeChild(timeframeNode, 'start_ts_s')?.content ?? '0', 10),
|
|
229
|
-
endTs: parseInt(timeframeNode?.attrs?.end_ts_s ?? getBinaryNodeChild(timeframeNode, 'end_ts_s')?.content ?? '0', 10),
|
|
230
|
-
resetTs: parseInt(timeframeNode?.attrs?.reset_ts_s ?? getBinaryNodeChild(timeframeNode, 'reset_ts_s')?.content ?? '0', 10)
|
|
231
|
-
};
|
|
232
|
-
};
|
|
233
|
-
/**
|
|
234
|
-
* Get the global chat-blocking status (block messages from unknown accounts).
|
|
235
|
-
* Ported from WhatsApp Web's WASmaxPsaChatBlockGetRPC (xmlns `w:comms:chat`).
|
|
236
|
-
* @returns {Promise<'blocked' | 'unblocked' | undefined>}
|
|
237
|
-
*/
|
|
238
|
-
const getChatBlockingStatus = async () => {
|
|
239
|
-
const result = await query({
|
|
240
|
-
tag: 'iq',
|
|
241
|
-
attrs: {
|
|
242
|
-
to: S_WHATSAPP_NET,
|
|
243
|
-
xmlns: 'w:comms:chat',
|
|
244
|
-
type: 'get'
|
|
245
|
-
},
|
|
246
|
-
content: [{ tag: 'query', attrs: {}, content: [{ tag: 'blocking_status', attrs: {} }] }]
|
|
247
|
-
});
|
|
248
|
-
const blocking = getBinaryNodeChild(result, 'blocking') ||
|
|
249
|
-
getBinaryNodeChild(getBinaryNodeChild(result, 'query'), 'blocking');
|
|
250
|
-
return blocking?.attrs?.status;
|
|
251
|
-
};
|
|
252
|
-
/**
|
|
253
|
-
* Set the global chat-blocking status (block messages from unknown accounts).
|
|
254
|
-
* Ported from WhatsApp Web's WASmaxPsaChatBlockSetRPC (xmlns `w:comms:chat`).
|
|
255
|
-
* @param {'block' | 'unblock'} action
|
|
256
|
-
* @returns {Promise<'blocked' | 'unblocked' | undefined>} the resulting status
|
|
257
|
-
*/
|
|
258
|
-
const updateChatBlockingStatus = async (action) => {
|
|
259
|
-
const result = await query({
|
|
260
|
-
tag: 'iq',
|
|
261
|
-
attrs: {
|
|
262
|
-
to: S_WHATSAPP_NET,
|
|
263
|
-
xmlns: 'w:comms:chat',
|
|
264
|
-
type: 'set'
|
|
265
|
-
},
|
|
266
|
-
content: [{ tag: 'blocking', attrs: { action } }]
|
|
267
|
-
});
|
|
268
|
-
const blocking = getBinaryNodeChild(result, 'blocking');
|
|
269
|
-
return blocking?.attrs?.status;
|
|
270
|
-
};
|
|
271
|
-
/**
|
|
272
|
-
* Get the user's pending TOS disclosures / notices (xmlns="tos").
|
|
273
|
-
* @param {number} [t] last-seen disclosure timestamp
|
|
274
|
-
* @returns {Promise<Array<Record<string, string>>>} the `<notice>` attributes
|
|
275
|
-
*/
|
|
276
|
-
const getUserDisclosures = async (t = 0) => {
|
|
277
|
-
const result = await query({
|
|
278
|
-
tag: 'iq',
|
|
279
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'tos', type: 'get' },
|
|
280
|
-
content: [{ tag: 'get_user_disclosures', attrs: { t: String(t) } }]
|
|
281
|
-
});
|
|
282
|
-
return getBinaryNodeChildren(result, 'notice').map(n => ({ ...n.attrs }));
|
|
283
|
-
};
|
|
284
|
-
/**
|
|
285
|
-
* Accept a TOS/disclosure notice (`xmlns="tos"` set with `<trackable>`).
|
|
286
|
-
* @param {string} noticeId the notice id (e.g. "20250211")
|
|
287
|
-
* @param {string|number} result the result code (e.g. "105")
|
|
288
|
-
*/
|
|
289
|
-
const acceptTosNotice = async (noticeId, result = '105') => {
|
|
290
|
-
await query({
|
|
291
|
-
tag: 'iq',
|
|
292
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'tos', type: 'set' },
|
|
293
|
-
content: [{ tag: 'trackable', attrs: { id: String(noticeId), result: String(result) } }]
|
|
294
|
-
});
|
|
295
|
-
};
|
|
296
|
-
/**
|
|
297
|
-
* Report spam for a chat/group with sample messages (xmlns="spam").
|
|
298
|
-
* @param {string} jid the JID of the chat or group being reported
|
|
299
|
-
* @param {Array<{id:string, from:string, t:number}>} messages up to ~5 recent messages as evidence
|
|
300
|
-
* @param {string} [spamFlow] e.g. "group_info_report" or "contact_info_report"
|
|
301
|
-
* @param {string} [subject] human-readable subject string (group name or contact name)
|
|
302
|
-
*/
|
|
303
|
-
const reportSpam = async (jid, messages, spamFlow = 'contact_info_report', subject) => {
|
|
304
|
-
const msgNodes = (messages || []).map(m => ({
|
|
305
|
-
tag: 'message',
|
|
306
|
-
attrs: {
|
|
307
|
-
from: String(jid),
|
|
308
|
-
t: String(m.t),
|
|
309
|
-
id: String(m.id)
|
|
310
|
-
}
|
|
311
|
-
}));
|
|
312
|
-
await query({
|
|
313
|
-
tag: 'iq',
|
|
314
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'spam', type: 'set' },
|
|
315
|
-
content: [
|
|
316
|
-
{
|
|
317
|
-
tag: 'spam_list',
|
|
318
|
-
attrs: {
|
|
319
|
-
jid: String(jid),
|
|
320
|
-
spam_flow: String(spamFlow),
|
|
321
|
-
...(subject ? { subject: String(subject) } : {})
|
|
322
|
-
},
|
|
323
|
-
content: msgNodes
|
|
324
|
-
}
|
|
325
|
-
]
|
|
326
|
-
});
|
|
327
|
-
};
|
|
328
|
-
/** Report a user through WhatsApp's w:report IQ endpoint. */
|
|
329
|
-
const reportUser = async (jid, reason = 'spam', waitForAckMs = 5000) => {
|
|
330
|
-
const resolvedJid = jidNormalizedUser(jid);
|
|
331
|
-
const reasonCodes = { spam: 1, harassment: 2, impersonation: 3, scam: 4, other: 5 };
|
|
332
|
-
const node = {
|
|
333
|
-
tag: 'iq',
|
|
334
|
-
attrs: { id: generateMessageTag(), xmlns: 'w:report', to: S_WHATSAPP_NET.replace(/^@/, ''), type: 'set' },
|
|
335
|
-
content: [{ tag: 'user', attrs: { jid: resolvedJid, reason: String(reasonCodes[reason] || 1) } }]
|
|
336
|
-
};
|
|
337
|
-
try {
|
|
338
|
-
await query(node, waitForAckMs);
|
|
339
|
-
logger.info({ jid: resolvedJid, reason }, 'reported user (ack received)');
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
catch (error) {
|
|
343
|
-
const statusCode = error?.output?.statusCode || error?.statusCode;
|
|
344
|
-
if (statusCode === 408 || error?.message?.toLowerCase?.().includes('timed out')) {
|
|
345
|
-
logger.warn({ jid: resolvedJid, reason }, 'reported user (no ack; request likely sent)');
|
|
346
|
-
return false;
|
|
347
|
-
}
|
|
348
|
-
throw error;
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
/** Report one message through WhatsApp's w:report IQ endpoint. */
|
|
352
|
-
const reportMessage = async (jid, messageId, reason = 'spam', participantJid, waitForAckMs = 5000) => {
|
|
353
|
-
const resolvedJid = jidNormalizedUser(jid);
|
|
354
|
-
const participant = participantJid ? jidNormalizedUser(participantJid) : undefined;
|
|
355
|
-
const reasonCodes = { spam: 1, harassment: 2, impersonation: 3, scam: 4, other: 5 };
|
|
356
|
-
const attrs = { id: String(messageId), reason: String(reasonCodes[reason] || 1) };
|
|
357
|
-
if (participant) attrs.participant = participant;
|
|
358
|
-
const node = {
|
|
359
|
-
tag: 'iq',
|
|
360
|
-
attrs: { id: generateMessageTag(), xmlns: 'w:report', to: S_WHATSAPP_NET.replace(/^@/, ''), type: 'set' },
|
|
361
|
-
content: [{ tag: 'message', attrs }]
|
|
362
|
-
};
|
|
363
|
-
try {
|
|
364
|
-
await query(node, waitForAckMs);
|
|
365
|
-
logger.info({ jid: resolvedJid, messageId, reason, participant }, 'reported message (ack received)');
|
|
366
|
-
return true;
|
|
367
|
-
}
|
|
368
|
-
catch (error) {
|
|
369
|
-
const statusCode = error?.output?.statusCode || error?.statusCode;
|
|
370
|
-
if (statusCode === 408 || error?.message?.toLowerCase?.().includes('timed out')) {
|
|
371
|
-
logger.warn({ jid: resolvedJid, messageId, reason, participant }, 'reported message (no ack; request likely sent)');
|
|
372
|
-
return false;
|
|
373
|
-
}
|
|
374
|
-
throw error;
|
|
375
|
-
}
|
|
376
|
-
};
|
|
377
|
-
const reportAndBlockUser = async (jid, reason = 'spam', waitForAckMs = 5000) => {
|
|
378
|
-
const resolvedJid = jidNormalizedUser(jid);
|
|
379
|
-
const acknowledged = await reportUser(resolvedJid, reason, waitForAckMs);
|
|
380
|
-
await updateBlockStatus(resolvedJid, 'block');
|
|
381
|
-
return acknowledged;
|
|
382
|
-
};
|
|
383
|
-
/** Toggle group member-share-history mode through the MEX endpoint. */
|
|
384
|
-
const toggleGroupHistory = async (jid, enable = true) => {
|
|
385
|
-
if (!jid) throw new Boom('toggleGroupHistory requires a group JID', { statusCode: 400 });
|
|
386
|
-
return query({
|
|
387
|
-
tag: 'iq',
|
|
388
|
-
attrs: { type: 'get', to: S_WHATSAPP_NET, xmlns: 'w:mex' },
|
|
389
|
-
content: [{
|
|
390
|
-
tag: 'query',
|
|
391
|
-
attrs: { query_id: '24688994337458819' },
|
|
392
|
-
content: Buffer.from(JSON.stringify({
|
|
393
|
-
variables: {
|
|
394
|
-
group_id: jid,
|
|
395
|
-
input: { member_share_group_history_mode: enable ? 'ALL_MEMBER_SHARE' : 'ADMIN_SHARE' }
|
|
396
|
-
}
|
|
397
|
-
}), 'utf-8')
|
|
398
|
-
}]
|
|
399
|
-
});
|
|
400
|
-
};
|
|
401
|
-
/**
|
|
402
|
-
* Get the account opt-out list (`optoutlist` IQ). Returns the raw result node.
|
|
403
|
-
*/
|
|
404
|
-
const getOptOutList = async () => {
|
|
405
|
-
return query({
|
|
406
|
-
tag: 'iq',
|
|
407
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'optoutlist', type: 'get' }
|
|
408
|
-
});
|
|
409
|
-
};
|
|
410
|
-
/**
|
|
411
|
-
* Sign a blinded credential for privacy-preserving anonymous stats (xmlns `privatestats`).
|
|
412
|
-
* @param {Buffer} blindedCredential 32-byte blinded credential
|
|
413
|
-
* @returns {Promise<Buffer|undefined>} signed credential bytes from server
|
|
414
|
-
*/
|
|
415
|
-
const signPrivateCredential = async (blindedCredential) => {
|
|
416
|
-
const result = await query({
|
|
417
|
-
tag: 'iq',
|
|
418
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'privatestats', type: 'get' },
|
|
419
|
-
content: [
|
|
420
|
-
{
|
|
421
|
-
tag: 'sign_credential',
|
|
422
|
-
attrs: { version: '1' },
|
|
423
|
-
content: [{ tag: 'blinded_credential', attrs: {}, content: blindedCredential }]
|
|
424
|
-
}
|
|
425
|
-
]
|
|
426
|
-
});
|
|
427
|
-
const signedNode = getBinaryNodeChild(result, 'sign_credential');
|
|
428
|
-
const signedBytes = getBinaryNodeChild(signedNode, 'signed_credential');
|
|
429
|
-
return signedBytes?.content instanceof Uint8Array ? Buffer.from(signedBytes.content) : undefined;
|
|
430
|
-
};
|
|
431
|
-
/**
|
|
432
|
-
* Get push-notification settings (`urn:xmpp:whatsapp:push`).
|
|
433
|
-
*/
|
|
434
|
-
const getPushConfig = async () => {
|
|
435
|
-
const result = await query({
|
|
436
|
-
tag: 'iq',
|
|
437
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'urn:xmpp:whatsapp:push', type: 'get' },
|
|
438
|
-
content: [{ tag: 'settings', attrs: {} }]
|
|
439
|
-
});
|
|
440
|
-
return getBinaryNodeChild(result, 'settings');
|
|
441
|
-
};
|
|
442
|
-
/**
|
|
443
|
-
* Set push-notification config (`urn:xmpp:whatsapp:push`). Mainly web push —
|
|
444
|
-
* pass the FCM-style config (platform / endpoint / auth / p256dh).
|
|
445
|
-
* @param {Record<string, string>} config
|
|
446
|
-
*/
|
|
447
|
-
const setPushConfig = async (config) => {
|
|
448
|
-
await query({
|
|
449
|
-
tag: 'iq',
|
|
450
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'urn:xmpp:whatsapp:push', type: 'set' },
|
|
451
|
-
content: [{ tag: 'config', attrs: config }]
|
|
452
|
-
});
|
|
453
|
-
};
|
|
454
|
-
/**
|
|
455
|
-
* Toggle the waiting room for a call link.
|
|
456
|
-
* @param {string} linkToken call-link token
|
|
457
|
-
* @param {boolean} enabled whether the waiting room is on
|
|
458
|
-
* @param {string} [media] "audio" | "video"
|
|
459
|
-
*/
|
|
460
|
-
const toggleCallLinkWaitingRoom = async (linkToken, enabled, media = 'audio') => {
|
|
461
|
-
const result = await query({
|
|
462
|
-
tag: 'call',
|
|
463
|
-
attrs: { id: generateMessageTag(), to: '@call' },
|
|
464
|
-
content: [
|
|
465
|
-
{
|
|
466
|
-
tag: 'waiting_room_toggle',
|
|
467
|
-
attrs: { enabled: enabled ? '1' : '0', 'link-token': linkToken, media }
|
|
468
|
-
}
|
|
469
|
-
]
|
|
470
|
-
});
|
|
471
|
-
const child = getBinaryNodeChild(result, 'waiting_room_toggle');
|
|
472
|
-
return child?.attrs;
|
|
473
|
-
};
|
|
474
|
-
/**
|
|
475
|
-
* Store privacy tokens received from a usync response per-contact.
|
|
476
|
-
* @param {Array<{jid: string, privacyToken: Buffer, privacyModeTs: number|string}>} entries
|
|
477
|
-
*/
|
|
478
|
-
const storePrivacyTokens = async (entries) => {
|
|
479
|
-
if (!entries?.length)
|
|
480
|
-
return;
|
|
481
|
-
const write = {};
|
|
482
|
-
for (const { jid, privacyToken, privacyModeTs } of entries) {
|
|
483
|
-
if (!jid || !privacyToken?.length)
|
|
484
|
-
continue;
|
|
485
|
-
write[jid] = {
|
|
486
|
-
token: Buffer.isBuffer(privacyToken) ? privacyToken : Buffer.from(privacyToken),
|
|
487
|
-
ts: String(privacyModeTs || '')
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
if (Object.keys(write).length) {
|
|
491
|
-
await authState.keys.set({ 'privacy-token': write });
|
|
492
|
-
}
|
|
493
|
-
};
|
|
494
|
-
/**
|
|
495
|
-
* Wrapper around sock.executeUSyncQuery that automatically persists any per-contact
|
|
496
|
-
* privacy tokens (privacy_mode_ts + privacy_token) present in the usync result list,
|
|
497
|
-
* and emits contacts.update for any entries flagged isBlockedByContact.
|
|
498
|
-
* @param {import('../WAUSync/USyncQuery.js').USyncQuery} usyncQuery
|
|
499
|
-
*/
|
|
500
|
-
const executeUSyncQuery = async (usyncQuery) => {
|
|
501
|
-
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
502
|
-
if (!result)
|
|
503
|
-
return result;
|
|
504
|
-
// auto-persist privacy tokens found in any usync response
|
|
505
|
-
const privacyEntries = [];
|
|
506
|
-
const blockedContacts = [];
|
|
507
|
-
for (const entry of [...(result.list || []), ...(result.sideList || [])]) {
|
|
508
|
-
if (entry.privacy?.token) {
|
|
509
|
-
privacyEntries.push({
|
|
510
|
-
jid: entry.id,
|
|
511
|
-
privacyToken: entry.privacy.token,
|
|
512
|
-
privacyModeTs: entry.privacy.modeTs
|
|
513
|
-
});
|
|
514
|
-
}
|
|
515
|
-
// emit contacts.update for contacts that blocked us
|
|
516
|
-
if (entry.isBlockedByContact) {
|
|
517
|
-
blockedContacts.push({ id: entry.id, isBlockedByContact: true });
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
if (privacyEntries.length) {
|
|
521
|
-
storePrivacyTokens(privacyEntries).catch(err => logger.warn({ err }, 'failed to store privacy tokens from usync'));
|
|
522
|
-
}
|
|
523
|
-
if (blockedContacts.length) {
|
|
524
|
-
ev.emit('contacts.update', blockedContacts);
|
|
525
|
-
}
|
|
526
|
-
return result;
|
|
527
|
-
};
|
|
528
|
-
const updateBioPrivacy = async (value) => {
|
|
529
|
-
await privacyQuery('about', value);
|
|
530
|
-
};
|
|
531
|
-
/**
|
|
532
|
-
* Block a bot JID
|
|
533
|
-
*/
|
|
534
|
-
const blockBot = async (botJid) => {
|
|
535
|
-
await query({
|
|
536
|
-
tag: 'iq',
|
|
537
|
-
attrs: {
|
|
538
|
-
xmlns: 'disappearing_mode',
|
|
539
|
-
to: S_WHATSAPP_NET,
|
|
540
|
-
type: 'set'
|
|
541
|
-
},
|
|
542
|
-
content: [
|
|
543
|
-
{
|
|
544
|
-
tag: 'block',
|
|
545
|
-
attrs: { jid: botJid }
|
|
546
|
-
}
|
|
547
|
-
]
|
|
548
|
-
});
|
|
549
|
-
};
|
|
550
|
-
/**
|
|
551
|
-
* Unblock a bot JID
|
|
552
|
-
*/
|
|
553
|
-
const unblockBot = async (botJid) => {
|
|
554
|
-
await updateBlockStatus(botJid, 'unblock');
|
|
555
|
-
};
|
|
556
|
-
const getBotProfile = async (botJid) => {
|
|
557
|
-
const resp = await query({
|
|
558
|
-
tag: 'iq',
|
|
559
|
-
attrs: {
|
|
560
|
-
xmlns: 'bot',
|
|
561
|
-
to: S_WHATSAPP_NET,
|
|
562
|
-
type: 'get'
|
|
563
|
-
},
|
|
564
|
-
content: [
|
|
565
|
-
{
|
|
566
|
-
tag: 'bot',
|
|
567
|
-
attrs: { v: '2', jid: botJid }
|
|
568
|
-
}
|
|
569
|
-
]
|
|
570
|
-
});
|
|
571
|
-
const botNode = getBinaryNodeChild(resp, 'bot');
|
|
572
|
-
if (!botNode)
|
|
573
|
-
return null;
|
|
574
|
-
return {
|
|
575
|
-
jid: botNode.attrs.jid,
|
|
576
|
-
personaId: botNode.attrs['persona_id'],
|
|
577
|
-
name: botNode.attrs.name,
|
|
578
|
-
description: botNode.attrs.description
|
|
579
|
-
};
|
|
580
|
-
};
|
|
581
|
-
/**
|
|
582
|
-
* Fetch AB-test (abt) props from server (xmlns="abt").
|
|
583
|
-
* @param {string} [protocol] e.g. "1" or "2"
|
|
584
|
-
* @param {string} [hash]
|
|
585
|
-
* @param {string|null} [refreshId]
|
|
586
|
-
* @param {string|null} [group] group-scoped query when set
|
|
587
|
-
*/
|
|
588
|
-
const fetchABProps = async (protocol = '1', hash = '', refreshId = null, group = null) => {
|
|
589
|
-
const propAttrs = group != null
|
|
590
|
-
? { group: String(group) }
|
|
591
|
-
: {
|
|
592
|
-
protocol,
|
|
593
|
-
...(hash ? { hash } : {}),
|
|
594
|
-
...(refreshId != null ? { refresh_id: String(refreshId) } : {})
|
|
595
|
-
};
|
|
596
|
-
const result = await query({
|
|
597
|
-
tag: 'iq',
|
|
598
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'abt', type: 'get' },
|
|
599
|
-
content: [{ tag: 'props', attrs: propAttrs }]
|
|
600
|
-
});
|
|
601
|
-
const propsNode = getBinaryNodeChild(result, 'props');
|
|
602
|
-
if (!propsNode)
|
|
603
|
-
return {};
|
|
604
|
-
return reduceBinaryNodeToDictionary(propsNode, 'prop');
|
|
605
|
-
};
|
|
606
|
-
/**
|
|
607
|
-
* Remove a companion (linked) device from the account (xmlns="md").
|
|
608
|
-
* @param {string} jid full device JID of the companion to remove
|
|
609
|
-
* @param {string} [reason] e.g. "user_initiated" | "unknown_companion"
|
|
610
|
-
*/
|
|
611
|
-
const removeCompanionDevice = async (jid, reason = 'user_initiated') => {
|
|
612
|
-
await query({
|
|
613
|
-
tag: 'iq',
|
|
614
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'md', type: 'set' },
|
|
615
|
-
content: [
|
|
616
|
-
{
|
|
617
|
-
tag: 'remove-companion-device',
|
|
618
|
-
attrs: { jid, reason }
|
|
619
|
-
}
|
|
620
|
-
]
|
|
621
|
-
});
|
|
622
|
-
};
|
|
623
|
-
/**
|
|
624
|
-
* Push an updated key-index-list to the server (xmlns="md", child "key-index-list").
|
|
625
|
-
* @param {number|string} ts unix timestamp seconds
|
|
626
|
-
* @param {Buffer} content serialized proto KeyIndexList
|
|
627
|
-
*/
|
|
628
|
-
const updateKeyIndexList = async (ts, content) => {
|
|
629
|
-
await query({
|
|
630
|
-
tag: 'iq',
|
|
631
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'md', type: 'set' },
|
|
632
|
-
content: [
|
|
633
|
-
{
|
|
634
|
-
tag: 'key-index-list',
|
|
635
|
-
attrs: { ts: String(ts) },
|
|
636
|
-
content
|
|
637
|
-
}
|
|
638
|
-
]
|
|
639
|
-
});
|
|
640
|
-
};
|
|
641
|
-
/**
|
|
642
|
-
* Build and push the companion's signed key-index-list on (re)connect (xmlns="md").
|
|
643
|
-
* Mirrors CompanionDeviceAdvUtil.A02 from the APK: the details proto is signed with
|
|
644
|
-
* our own device identity key (the same key that produces the ADV deviceSignature).
|
|
645
|
-
*/
|
|
646
|
-
const sendKeyIndexList = async () => {
|
|
647
|
-
const account = authState.creds.account;
|
|
648
|
-
const signedIdentityKey = authState.creds.signedIdentityKey;
|
|
649
|
-
if (!account?.details || !signedIdentityKey?.private) {
|
|
650
|
-
logger.debug('no ADV account / signed identity key, skipping key-index-list');
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
const deviceIdentity = proto.ADVDeviceIdentity.decode(account.details);
|
|
654
|
-
const keyIndex = deviceIdentity.keyIndex || 0;
|
|
655
|
-
const accountType = deviceIdentity.accountType ?? proto.ADVEncryptionType.E2EE;
|
|
656
|
-
const isHosted = accountType === proto.ADVEncryptionType.HOSTED;
|
|
657
|
-
const ts = Math.floor(Date.now() / 1000);
|
|
658
|
-
const details = proto.ADVKeyIndexList.encode({
|
|
659
|
-
rawId: deviceIdentity.rawId || 0,
|
|
660
|
-
timestamp: ts,
|
|
661
|
-
currentIndex: keyIndex,
|
|
662
|
-
validIndexes: [keyIndex],
|
|
663
|
-
accountType
|
|
664
|
-
}).finish();
|
|
665
|
-
const sigPrefix = isHosted ? WA_ADV_HOSTED_KEY_INDEX_LIST_SIG_PREFIX : WA_ADV_KEY_INDEX_LIST_SIG_PREFIX;
|
|
666
|
-
const accountSignature = Curve.sign(signedIdentityKey.private, Buffer.concat([sigPrefix, details]));
|
|
667
|
-
const signedKeyIndexList = { details, accountSignature };
|
|
668
|
-
if (isHosted && account.accountSignatureKey?.length) {
|
|
669
|
-
signedKeyIndexList.accountSignatureKey = account.accountSignatureKey;
|
|
670
|
-
}
|
|
671
|
-
const content = proto.ADVSignedKeyIndexList.encode(signedKeyIndexList).finish();
|
|
672
|
-
await updateKeyIndexList(ts, Buffer.from(content));
|
|
673
|
-
logger.info({ ts, keyIndex }, 'sent key-index-list');
|
|
674
|
-
};
|
|
675
|
-
/**
|
|
676
|
-
* Request a media upload connection token from the server (xmlns="w:m").
|
|
677
|
-
* @param {string|null} [lastId]
|
|
678
|
-
*/
|
|
679
|
-
const fetchMediaConn = async (lastId = null) => {
|
|
680
|
-
const attrs = {};
|
|
681
|
-
if (lastId != null)
|
|
682
|
-
attrs.last_id = String(lastId);
|
|
683
|
-
const result = await query({
|
|
684
|
-
tag: 'iq',
|
|
685
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'w:m', type: 'set' },
|
|
686
|
-
content: [{ tag: 'media_conn', attrs }]
|
|
687
|
-
});
|
|
688
|
-
return getBinaryNodeChild(result, 'media_conn') || null;
|
|
689
|
-
};
|
|
690
|
-
/**
|
|
691
|
-
* Delete a broadcast list by ID (xmlns="w:b").
|
|
692
|
-
*/
|
|
693
|
-
const deleteBroadcastList = async (listId) => {
|
|
694
|
-
await query({
|
|
695
|
-
tag: 'iq',
|
|
696
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'w:b', type: 'set' },
|
|
697
|
-
content: [
|
|
698
|
-
{
|
|
699
|
-
tag: 'delete',
|
|
700
|
-
attrs: {},
|
|
701
|
-
content: [{ tag: 'list', attrs: { id: String(listId) } }]
|
|
702
|
-
}
|
|
703
|
-
]
|
|
704
|
-
});
|
|
705
|
-
};
|
|
706
|
-
/**
|
|
707
|
-
* Fetch a QR code from the server (e.g. for linked-device linking) (xmlns="w:qr").
|
|
708
|
-
* @param {string} code
|
|
709
|
-
* @param {'lid'|null} [addressingMode] set to "lid" for LID-addressed QR
|
|
710
|
-
*/
|
|
711
|
-
const fetchQRCode = async (code, addressingMode = null) => {
|
|
712
|
-
const attrs = { code };
|
|
713
|
-
if (addressingMode)
|
|
714
|
-
attrs.addressing_mode = addressingMode;
|
|
715
|
-
const result = await query({
|
|
716
|
-
tag: 'iq',
|
|
717
|
-
attrs: { to: S_WHATSAPP_NET, xmlns: 'w:qr', type: 'get' },
|
|
718
|
-
content: [{ tag: 'qr', attrs }]
|
|
719
|
-
});
|
|
720
|
-
return getBinaryNodeChild(result, 'qr') || null;
|
|
721
|
-
};
|
|
722
|
-
/**
|
|
723
|
-
* Confirm or deny a device-logout request from the server (xmlns="w:account_defence").
|
|
724
|
-
* @param {string|number} id the challenge id
|
|
725
|
-
* @param {boolean} [approve] true to confirm the logout, false to deny
|
|
726
|
-
*/
|
|
727
|
-
const confirmDeviceLogout = async (id, approve = true) => {
|
|
728
|
-
await query({
|
|
729
|
-
tag: 'iq',
|
|
730
|
-
attrs: {
|
|
731
|
-
id: String(id),
|
|
732
|
-
to: S_WHATSAPP_NET,
|
|
733
|
-
xmlns: 'w:account_defence',
|
|
734
|
-
type: 'set',
|
|
735
|
-
smax_id: '87'
|
|
736
|
-
},
|
|
737
|
-
content: [
|
|
738
|
-
{
|
|
739
|
-
tag: 'device_logout',
|
|
740
|
-
attrs: { approve: approve ? 'true' : 'false', id: String(id) }
|
|
741
|
-
}
|
|
742
|
-
]
|
|
743
|
-
});
|
|
744
|
-
};
|
|
745
146
|
const getBotListV2 = async () => {
|
|
746
147
|
const resp = await query({
|
|
747
148
|
tag: 'iq',
|
|
@@ -802,28 +203,18 @@ export const makeChatsSocket = (config) => {
|
|
|
802
203
|
};
|
|
803
204
|
if (isPnUser(normalizedJid) || isHostedPnUser(normalizedJid)) {
|
|
804
205
|
userId.phoneNumber = normalizedJid;
|
|
805
|
-
|
|
806
|
-
userId.lid = resolvedLid ? jidNormalizedUser(resolvedLid) : undefined;
|
|
206
|
+
userId.lid = jidNormalizedUser((await signalRepository.lidMapping.getLIDsForPNs([normalizedJid]))?.[0]?.lid);
|
|
807
207
|
}
|
|
808
208
|
else if (isLidUser(normalizedJid) || isHostedLidUser(normalizedJid)) {
|
|
809
209
|
userId.lid = normalizedJid;
|
|
810
|
-
|
|
811
|
-
userId.phoneNumber = resolvedPhoneNumber ? jidNormalizedUser(resolvedPhoneNumber) : undefined;
|
|
210
|
+
userId.phoneNumber = jidNormalizedUser((await signalRepository.lidMapping.getPNsForLIDs([normalizedJid]))?.[0]?.pn);
|
|
812
211
|
}
|
|
813
212
|
else {
|
|
814
213
|
throw new Boom('Invalid id input to find user ids', { statusCode: 400 });
|
|
815
214
|
}
|
|
816
215
|
return userId;
|
|
817
216
|
};
|
|
818
|
-
/** update the profile picture for yourself or a group
|
|
819
|
-
*
|
|
820
|
-
* Standard (crop + resize to 720×720):
|
|
821
|
-
* sock.updateProfilePicture(jid, content)
|
|
822
|
-
* sock.updateProfilePicture(jid, content, { width: 640, height: 640 })
|
|
823
|
-
*
|
|
824
|
-
* HD (full-size, no crop, no resize):
|
|
825
|
-
* sock.updateProfilePicture(jid, content, { hd: true })
|
|
826
|
-
*/
|
|
217
|
+
/** update the profile picture for yourself or a group */
|
|
827
218
|
const updateProfilePicture = async (jid, content, dimensions) => {
|
|
828
219
|
let targetJid;
|
|
829
220
|
if (!jid) {
|
|
@@ -835,12 +226,7 @@ export const makeChatsSocket = (config) => {
|
|
|
835
226
|
else {
|
|
836
227
|
targetJid = undefined;
|
|
837
228
|
}
|
|
838
|
-
|
|
839
|
-
// hd:true → generateProfilePictureHD (preserves aspect ratio, caps at 1920, manages file size)
|
|
840
|
-
// standard → generateProfilePicture (720×720 square crop, or custom dimensions)
|
|
841
|
-
const { img } = dimensions?.hd
|
|
842
|
-
? await generateProfilePictureHD(content)
|
|
843
|
-
: await generateProfilePicture(content, dimensions);
|
|
229
|
+
const { img } = await generateProfilePicture(content, dimensions);
|
|
844
230
|
await query({
|
|
845
231
|
tag: 'iq',
|
|
846
232
|
attrs: {
|
|
@@ -882,9 +268,6 @@ export const makeChatsSocket = (config) => {
|
|
|
882
268
|
};
|
|
883
269
|
/** update the profile status for yourself */
|
|
884
270
|
const updateProfileStatus = async (status) => {
|
|
885
|
-
if (typeof status !== 'string') {
|
|
886
|
-
throw new TypeError('Profile status must be a string');
|
|
887
|
-
}
|
|
888
271
|
await query({
|
|
889
272
|
tag: 'iq',
|
|
890
273
|
attrs: {
|
|
@@ -902,9 +285,6 @@ export const makeChatsSocket = (config) => {
|
|
|
902
285
|
});
|
|
903
286
|
};
|
|
904
287
|
const updateProfileName = async (name) => {
|
|
905
|
-
if (typeof name !== 'string') {
|
|
906
|
-
throw new TypeError('Profile name must be a string');
|
|
907
|
-
}
|
|
908
288
|
await chatModify({ pushNameSetting: name }, '');
|
|
909
289
|
};
|
|
910
290
|
const fetchBlocklist = async () => {
|
|
@@ -1192,8 +572,7 @@ export const makeChatsSocket = (config) => {
|
|
|
1192
572
|
* type = "preview" for a low res picture
|
|
1193
573
|
* type = "image for the high res picture"
|
|
1194
574
|
*/
|
|
1195
|
-
const profilePictureUrl = async (jid, type = 'image', timeoutMs = 5000, shouldIncludeTcToken =
|
|
1196
|
-
const baseContent = [{ tag: 'picture', attrs: { type, query: 'url' } }];
|
|
575
|
+
const profilePictureUrl = async (jid, type = 'image', timeoutMs = 5000, shouldIncludeTcToken = true) => {
|
|
1197
576
|
// WA Web only includes tctoken for user JIDs (not groups/newsletters)
|
|
1198
577
|
// and never for own profile pic (Chat model for self has no tcToken).
|
|
1199
578
|
// Including tctoken for own JID causes the server to never respond.
|
|
@@ -1201,12 +580,11 @@ export const makeChatsSocket = (config) => {
|
|
|
1201
580
|
const isUserJid = isPnUser(normalizedJid) || isLidUser(normalizedJid);
|
|
1202
581
|
const me = authState.creds.me;
|
|
1203
582
|
const isSelf = me && (normalizedJid === jidNormalizedUser(me.id) || (me.lid && normalizedJid === jidNormalizedUser(me.lid)));
|
|
1204
|
-
let
|
|
583
|
+
let tcTokenContent;
|
|
1205
584
|
if (shouldIncludeTcToken && serverProps.profilePicPrivacyToken && isUserJid && !isSelf) {
|
|
1206
|
-
|
|
585
|
+
tcTokenContent = await buildTcTokenFromJid({
|
|
1207
586
|
authState,
|
|
1208
587
|
jid: normalizedJid,
|
|
1209
|
-
baseContent,
|
|
1210
588
|
getLIDForPN
|
|
1211
589
|
});
|
|
1212
590
|
}
|
|
@@ -1219,7 +597,7 @@ export const makeChatsSocket = (config) => {
|
|
|
1219
597
|
type: 'get',
|
|
1220
598
|
xmlns: 'w:profile:picture'
|
|
1221
599
|
},
|
|
1222
|
-
content
|
|
600
|
+
content: buildProfilePictureQueryContent(type, tcTokenContent)
|
|
1223
601
|
}, timeoutMs);
|
|
1224
602
|
const child = getBinaryNodeChild(result, 'picture');
|
|
1225
603
|
return child?.attrs?.url;
|
|
@@ -1549,26 +927,6 @@ export const makeChatsSocket = (config) => {
|
|
|
1549
927
|
quickReply: { timestamp, deleted: true }
|
|
1550
928
|
}, '');
|
|
1551
929
|
};
|
|
1552
|
-
/**
|
|
1553
|
-
* crysnovax@Favorites --- Set complete WhatsApp Favorites list.
|
|
1554
|
-
* Replaces server-side list with the provided array (merging is handled by caller).
|
|
1555
|
-
* @param jids — complete array of JIDs to set as favorites
|
|
1556
|
-
*/
|
|
1557
|
-
const addToFavorites = (jids) => {
|
|
1558
|
-
return chatModify({
|
|
1559
|
-
favorites: { jids, add: true }
|
|
1560
|
-
}, '');
|
|
1561
|
-
};
|
|
1562
|
-
/**
|
|
1563
|
-
* crysnovax@Favorites --- Remove all favorites (clear list).
|
|
1564
|
-
*/
|
|
1565
|
-
const removeFromFavorites = (jids) => {
|
|
1566
|
-
// For single removal, caller must pass remaining list to addToFavorites
|
|
1567
|
-
// This sends the provided jids array (should be remaining items after filter)
|
|
1568
|
-
return chatModify({
|
|
1569
|
-
favorites: { jids, add: true }
|
|
1570
|
-
}, '');
|
|
1571
|
-
};
|
|
1572
930
|
/**
|
|
1573
931
|
* queries need to be fired on connection open
|
|
1574
932
|
* help ensure parity with WA Web
|
|
@@ -1576,21 +934,7 @@ export const makeChatsSocket = (config) => {
|
|
|
1576
934
|
const executeInitQueries = async () => {
|
|
1577
935
|
await Promise.all([fetchProps(), fetchBlocklist(), fetchPrivacySettings()]);
|
|
1578
936
|
};
|
|
1579
|
-
|
|
1580
937
|
const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
|
|
1581
|
-
// Cache newsletter server_id for use when this message is later quoted
|
|
1582
|
-
if (msg.newsletter && msg.newsletter_server_id && msg.key?.id) {
|
|
1583
|
-
_nlServerIdCache.set(msg.key.id, msg.newsletter_server_id);
|
|
1584
|
-
}
|
|
1585
|
-
// If this message quotes a newsletter post, enrich it with the cached server_id
|
|
1586
|
-
if (msg.message) {
|
|
1587
|
-
const ci = Object.values(msg.message).find(v => v?.contextInfo)?.contextInfo;
|
|
1588
|
-
if (ci?.stanzaId && isJidNewsletter(ci.remoteJid)) {
|
|
1589
|
-
const sid = _nlServerIdCache.get(ci.stanzaId);
|
|
1590
|
-
if (sid != null)
|
|
1591
|
-
msg.quotedNewsletterServerId = sid;
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
938
|
ev.emit('messages.upsert', { messages: [msg], type });
|
|
1595
939
|
if (!!msg.pushName) {
|
|
1596
940
|
let jid = msg.key.fromMe ? authState.creds.me.id : msg.key.participant || msg.key.remoteJid;
|
|
@@ -1855,37 +1199,6 @@ export const makeChatsSocket = (config) => {
|
|
|
1855
1199
|
updateReadReceiptsPrivacy,
|
|
1856
1200
|
updateGroupsAddPrivacy,
|
|
1857
1201
|
updateDefaultDisappearingMode,
|
|
1858
|
-
getStatusPrivacy,
|
|
1859
|
-
setStatusPrivacy,
|
|
1860
|
-
fetchBroadcastListQuota,
|
|
1861
|
-
getChatBlockingStatus,
|
|
1862
|
-
updateChatBlockingStatus,
|
|
1863
|
-
getUserDisclosures,
|
|
1864
|
-
acceptTosNotice,
|
|
1865
|
-
reportSpam,
|
|
1866
|
-
reportUser,
|
|
1867
|
-
reportMessage,
|
|
1868
|
-
reportAndBlockUser,
|
|
1869
|
-
toggleGroupHistory,
|
|
1870
|
-
getOptOutList,
|
|
1871
|
-
signPrivateCredential,
|
|
1872
|
-
getPushConfig,
|
|
1873
|
-
setPushConfig,
|
|
1874
|
-
toggleCallLinkWaitingRoom,
|
|
1875
|
-
storePrivacyTokens,
|
|
1876
|
-
executeUSyncQuery,
|
|
1877
|
-
updateBioPrivacy,
|
|
1878
|
-
blockBot,
|
|
1879
|
-
unblockBot,
|
|
1880
|
-
getBotProfile,
|
|
1881
|
-
fetchABProps,
|
|
1882
|
-
removeCompanionDevice,
|
|
1883
|
-
updateKeyIndexList,
|
|
1884
|
-
sendKeyIndexList,
|
|
1885
|
-
fetchMediaConn,
|
|
1886
|
-
deleteBroadcastList,
|
|
1887
|
-
fetchQRCode,
|
|
1888
|
-
confirmDeviceLogout,
|
|
1889
1202
|
getBusinessProfile,
|
|
1890
1203
|
resyncAppState,
|
|
1891
1204
|
chatModify,
|
|
@@ -1900,9 +1213,7 @@ export const makeChatsSocket = (config) => {
|
|
|
1900
1213
|
removeMessageLabel,
|
|
1901
1214
|
star,
|
|
1902
1215
|
addOrEditQuickReply,
|
|
1903
|
-
removeQuickReply
|
|
1904
|
-
addToFavorites,
|
|
1905
|
-
removeFromFavorites,
|
|
1906
|
-
newsletterServerIdCache: _nlServerIdCache
|
|
1216
|
+
removeQuickReply
|
|
1907
1217
|
};
|
|
1908
1218
|
};
|
|
1219
|
+
//# sourceMappingURL=chats.js.map
|