@neelegirl/baileys 1.5.2 → 1.5.4
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/README.md +26 -18
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +291 -665
- package/WAProto/fix-imports.js +29 -0
- package/WAProto/index.d.ts +2297 -48040
- package/WAProto/index.js +45500 -140101
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +58 -64
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +74 -96
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/ciphertext-message.js.map +1 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group-session-builder.js.map +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.d.ts.map +1 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/index.js.map +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/keyhelper.js.map +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-chain-key.js.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-name.js.map +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-record.js.map +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-key-state.js.map +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
- package/lib/Signal/{WASignalGroup/sender_message_key.js → Group/sender-message-key.js} +3 -16
- package/lib/Signal/Group/sender-message-key.js.map +1 -0
- package/lib/Signal/libsignal.d.ts +5 -4
- package/lib/Signal/libsignal.d.ts.map +1 -0
- package/lib/Signal/libsignal.js +292 -112
- package/lib/Signal/libsignal.js.map +1 -0
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -0
- package/lib/Signal/lid-mapping.js +171 -0
- package/lib/Signal/lid-mapping.js.map +1 -0
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.d.ts.map +1 -0
- package/lib/Socket/Client/index.js +3 -22
- package/lib/Socket/Client/index.js.map +1 -0
- package/lib/Socket/Client/types.d.ts +15 -15
- package/lib/Socket/Client/types.d.ts.map +1 -0
- package/lib/Socket/Client/types.js +8 -15
- package/lib/Socket/Client/types.js.map +1 -0
- package/lib/Socket/Client/websocket.d.ts +12 -12
- package/lib/Socket/Client/websocket.d.ts.map +1 -0
- package/lib/Socket/Client/websocket.js +24 -36
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +178 -177
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +179 -71
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +93 -93
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +474 -625
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +83 -62
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +412 -414
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/groups.d.ts +118 -112
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +146 -171
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +222 -182
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +12 -17
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/messages-recv.d.ts +165 -169
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +1185 -1721
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +161 -159
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +650 -991
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.d.ts.map +1 -0
- package/lib/Socket/mex.js +4 -9
- package/lib/Socket/mex.js.map +1 -0
- package/lib/Socket/newsletter.d.ts +139 -139
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +153 -258
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +42 -36
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +623 -507
- package/lib/Socket/socket.js.map +1 -0
- package/lib/Types/Auth.d.ts +87 -96
- package/lib/Types/Auth.d.ts.map +1 -0
- package/lib/Types/Auth.js +2 -3
- package/lib/Types/Auth.js.map +1 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.d.ts.map +1 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Bussines.js.map +1 -0
- package/lib/Types/Call.d.ts +13 -13
- package/lib/Types/Call.d.ts.map +1 -0
- package/lib/Types/Call.js +2 -3
- package/lib/Types/Call.js.map +1 -0
- package/lib/Types/Chat.d.ts +79 -94
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +8 -9
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Contact.d.ts +13 -9
- package/lib/Types/Contact.d.ts.map +1 -0
- package/lib/Types/Contact.js +2 -3
- package/lib/Types/Contact.js.map +1 -0
- package/lib/Types/Events.d.ts +152 -179
- package/lib/Types/Events.d.ts.map +1 -0
- package/lib/Types/Events.js +2 -3
- package/lib/Types/Events.js.map +1 -0
- package/lib/Types/GroupMetadata.d.ts +49 -48
- package/lib/Types/GroupMetadata.d.ts.map +1 -0
- package/lib/Types/GroupMetadata.js +2 -3
- package/lib/Types/GroupMetadata.js.map +1 -0
- package/lib/Types/Label.d.ts +13 -14
- package/lib/Types/Label.d.ts.map +1 -0
- package/lib/Types/Label.js +24 -30
- package/lib/Types/Label.js.map +1 -0
- package/lib/Types/LabelAssociation.d.ts +15 -20
- package/lib/Types/LabelAssociation.d.ts.map +1 -0
- package/lib/Types/LabelAssociation.js +6 -12
- package/lib/Types/LabelAssociation.js.map +1 -0
- package/lib/Types/Message.d.ts +234 -404
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +11 -13
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Newsletter.d.ts +130 -104
- package/lib/Types/Newsletter.d.ts.map +1 -0
- package/lib/Types/Newsletter.js +31 -40
- package/lib/Types/Newsletter.js.map +1 -0
- package/lib/Types/Product.d.ts +58 -71
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +2 -3
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/Signal.d.ts +63 -55
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +2 -3
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +78 -65
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +3 -3
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +17 -19
- package/lib/Types/State.d.ts.map +1 -0
- package/lib/Types/State.js +13 -14
- package/lib/Types/State.js.map +1 -0
- package/lib/Types/USync.d.ts +8 -8
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +2 -3
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +47 -61
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +26 -48
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +8 -10
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +206 -154
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/baileys-event-stream.d.ts +6 -7
- package/lib/Utils/baileys-event-stream.d.ts.map +1 -0
- package/lib/Utils/baileys-event-stream.js +29 -43
- package/lib/Utils/baileys-event-stream.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/browser-utils.js.map +1 -0
- package/lib/Utils/business.d.ts +14 -20
- package/lib/Utils/business.d.ts.map +1 -0
- package/lib/Utils/business.js +110 -134
- package/lib/Utils/business.js.map +1 -0
- package/lib/Utils/chat-utils.d.ts +57 -69
- package/lib/Utils/chat-utils.d.ts.map +1 -0
- package/lib/Utils/chat-utils.js +362 -380
- package/lib/Utils/chat-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +30 -45
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +141 -178
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/decode-wa-message.d.ts +42 -35
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +176 -150
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +12 -17
- package/lib/Utils/event-buffer.d.ts.map +1 -0
- package/lib/Utils/event-buffer.js +269 -286
- package/lib/Utils/event-buffer.js.map +1 -0
- package/lib/Utils/generics.d.ts +60 -99
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +244 -487
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +18 -22
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +54 -80
- package/lib/Utils/history.js.map +1 -0
- package/lib/Utils/index.d.ts +20 -19
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +19 -39
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +12 -14
- package/lib/Utils/link-preview.d.ts.map +1 -0
- package/lib/Utils/link-preview.js +40 -75
- package/lib/Utils/link-preview.js.map +1 -0
- package/lib/Utils/logger.d.ts +10 -11
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +3 -7
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/lt-hash.d.ts +12 -13
- package/lib/Utils/lt-hash.d.ts.map +1 -0
- package/lib/Utils/lt-hash.js +27 -37
- package/lib/Utils/lt-hash.js.map +1 -0
- package/lib/Utils/make-mutex.d.ts +6 -7
- package/lib/Utils/make-mutex.d.ts.map +1 -0
- package/lib/Utils/make-mutex.js +20 -29
- package/lib/Utils/make-mutex.js.map +1 -0
- package/lib/Utils/message-retry-manager.d.ts +82 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +149 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +87 -102
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +427 -570
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +37 -64
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +511 -1270
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +18 -18
- package/lib/Utils/noise-handler.d.ts.map +1 -0
- package/lib/Utils/noise-handler.js +101 -109
- package/lib/Utils/noise-handler.js.map +1 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-message.d.ts +25 -32
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +266 -281
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/signal.d.ts +24 -32
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +98 -105
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +5 -10
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +69 -186
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +11 -13
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +124 -116
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +25 -27
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +1277 -1292
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +7 -9
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +139 -189
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +105 -154
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/generic-utils.d.ts +14 -27
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +62 -102
- package/lib/WABinary/generic-utils.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -5
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +6 -25
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +41 -46
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +84 -80
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +10 -13
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +2 -3
- package/lib/WABinary/types.js.map +1 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -15
- package/lib/WAM/BinaryInfo.d.ts.map +1 -0
- package/lib/WAM/BinaryInfo.js +7 -14
- package/lib/WAM/BinaryInfo.js.map +1 -0
- package/lib/WAM/constants.d.ts +30 -37
- package/lib/WAM/constants.d.ts.map +1 -0
- package/lib/WAM/constants.js +19193 -11711
- package/lib/WAM/constants.js.map +1 -0
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.d.ts.map +1 -0
- package/lib/WAM/encode.js +95 -110
- package/lib/WAM/encode.js.map +1 -0
- package/lib/WAM/index.d.ts +4 -3
- package/lib/WAM/index.d.ts.map +1 -0
- package/lib/WAM/index.js +4 -23
- package/lib/WAM/index.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +12 -19
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +19 -22
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +18 -26
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +11 -12
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -20
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +11 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +16 -24
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -6
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +5 -26
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -28
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +64 -62
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +11 -10
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +12 -19
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -3
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +4 -23
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +10 -11
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -33
- package/lib/index.js.map +1 -0
- package/package.json +48 -43
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/WASignalGroup/GroupProtocol.js +0 -1909
- package/lib/Signal/WASignalGroup/ciphertext_message.js +0 -16
- package/lib/Signal/WASignalGroup/generate-proto.sh +0 -1
- package/lib/Signal/WASignalGroup/group.proto +0 -42
- package/lib/Signal/WASignalGroup/group_cipher.js +0 -120
- package/lib/Signal/WASignalGroup/group_session_builder.js +0 -46
- package/lib/Signal/WASignalGroup/index.js +0 -6
- package/lib/Signal/WASignalGroup/keyhelper.js +0 -21
- package/lib/Signal/WASignalGroup/protobufs.js +0 -3
- package/lib/Signal/WASignalGroup/queue_job.js +0 -69
- package/lib/Signal/WASignalGroup/readme.md +0 -6
- package/lib/Signal/WASignalGroup/sender_chain_key.js +0 -50
- package/lib/Signal/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/lib/Signal/WASignalGroup/sender_key_message.js +0 -92
- package/lib/Signal/WASignalGroup/sender_key_name.js +0 -70
- package/lib/Signal/WASignalGroup/sender_key_record.js +0 -56
- package/lib/Signal/WASignalGroup/sender_key_state.js +0 -129
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -15
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/registration.d.ts +0 -266
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Socket/usync.js +0 -83
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/index.js +0 -24
- package/lib/Store/make-cache-manager-store.d.ts +0 -14
- package/lib/Store/make-cache-manager-store.js +0 -90
- package/lib/Store/make-in-memory-store.d.ts +0 -123
- package/lib/Store/make-in-memory-store.js +0 -429
- package/lib/Store/make-ordered-dictionary.d.ts +0 -12
- package/lib/Store/make-ordered-dictionary.js +0 -86
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Store/object-repository.js +0 -31
- package/lib/Types/MexUpdates.d.ts +0 -9
- package/lib/Types/MexUpdates.js +0 -18
- package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-mongo-file-auth-state.js +0 -84
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.js +0 -80
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -69
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -30
package/lib/Socket/chats.js
CHANGED
|
@@ -1,80 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const makeChatsSocket = (config) => {
|
|
22
|
-
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, } = config
|
|
23
|
-
const Neele = usync_1.makeUSyncSocket(config)
|
|
24
|
-
const { ev, ws, authState, generateMessageTag, sendNode, query, onUnexpectedError, groupFetchAllParticipating } = Neele
|
|
25
|
-
|
|
26
|
-
let privacySettings
|
|
27
|
-
let syncState = Types_1.SyncState.Connecting
|
|
28
|
-
|
|
1
|
+
import NodeCache from '@cacheable/node-cache';
|
|
2
|
+
import { Boom } from '@hapi/boom';
|
|
3
|
+
import { proto } from '../../WAProto/index.js';
|
|
4
|
+
import { DEFAULT_CACHE_TTLS, PROCESSABLE_HISTORY_TYPES } from '../Defaults/index.js';
|
|
5
|
+
import { ALL_WA_PATCH_NAMES } from '../Types/index.js';
|
|
6
|
+
import { SyncState } from '../Types/State.js';
|
|
7
|
+
import { chatModificationToAppPatch, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, extractSyncdPatches, generateProfilePicture, getHistoryMsg, newLTHashState, processSyncAction } from '../Utils/index.js';
|
|
8
|
+
import { makeMutex } from '../Utils/make-mutex.js';
|
|
9
|
+
import processMessage from '../Utils/process-message.js';
|
|
10
|
+
import { getBinaryNodeChild, getBinaryNodeChildren, jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
11
|
+
import { USyncQuery, USyncUser } from '../WAUSync/index.js';
|
|
12
|
+
import { makeSocket } from './socket.js';
|
|
13
|
+
const MAX_SYNC_ATTEMPTS = 2;
|
|
14
|
+
export const makeChatsSocket = (config) => {
|
|
15
|
+
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage } = config;
|
|
16
|
+
const sock = makeSocket(config);
|
|
17
|
+
const { ev, ws, authState, generateMessageTag, sendNode, query, signalRepository, onUnexpectedError } = sock;
|
|
18
|
+
let privacySettings;
|
|
19
|
+
let syncState = SyncState.Connecting;
|
|
29
20
|
/** this mutex ensures that the notifications (receipts, messages etc.) are processed in order */
|
|
30
|
-
const processingMutex =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
39
|
-
|
|
21
|
+
const processingMutex = makeMutex();
|
|
22
|
+
// Timeout for AwaitingInitialSync state
|
|
23
|
+
let awaitingSyncTimeout;
|
|
24
|
+
const placeholderResendCache = config.placeholderResendCache ||
|
|
25
|
+
new NodeCache({
|
|
26
|
+
stdTTL: DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
|
|
27
|
+
useClones: false
|
|
28
|
+
});
|
|
40
29
|
if (!config.placeholderResendCache) {
|
|
41
|
-
config.placeholderResendCache = placeholderResendCache
|
|
30
|
+
config.placeholderResendCache = placeholderResendCache;
|
|
42
31
|
}
|
|
43
|
-
|
|
44
32
|
/** helper function to fetch the given app state sync key */
|
|
45
33
|
const getAppStateSyncKey = async (keyId) => {
|
|
46
|
-
const { [keyId]: key } = await authState.keys.get('app-state-sync-key', [keyId])
|
|
47
|
-
return key
|
|
48
|
-
}
|
|
49
|
-
|
|
34
|
+
const { [keyId]: key } = await authState.keys.get('app-state-sync-key', [keyId]);
|
|
35
|
+
return key;
|
|
36
|
+
};
|
|
50
37
|
const fetchPrivacySettings = async (force = false) => {
|
|
51
38
|
if (!privacySettings || force) {
|
|
52
39
|
const { content } = await query({
|
|
53
40
|
tag: 'iq',
|
|
54
41
|
attrs: {
|
|
55
42
|
xmlns: 'privacy',
|
|
56
|
-
to:
|
|
43
|
+
to: S_WHATSAPP_NET,
|
|
57
44
|
type: 'get'
|
|
58
45
|
},
|
|
59
|
-
content: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
privacySettings = WABinary_1.reduceBinaryNodeToDictionary(content?.[0], 'category')
|
|
46
|
+
content: [{ tag: 'privacy', attrs: {} }]
|
|
47
|
+
});
|
|
48
|
+
privacySettings = reduceBinaryNodeToDictionary(content?.[0], 'category');
|
|
64
49
|
}
|
|
65
|
-
return privacySettings
|
|
66
|
-
}
|
|
67
|
-
|
|
50
|
+
return privacySettings;
|
|
51
|
+
};
|
|
68
52
|
/** helper function to run a privacy IQ query */
|
|
69
53
|
const privacyQuery = async (name, value) => {
|
|
70
54
|
await query({
|
|
71
55
|
tag: 'iq',
|
|
72
56
|
attrs: {
|
|
73
57
|
xmlns: 'privacy',
|
|
74
|
-
to:
|
|
58
|
+
to: S_WHATSAPP_NET,
|
|
75
59
|
type: 'set'
|
|
76
60
|
},
|
|
77
|
-
content: [
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
78
63
|
tag: 'privacy',
|
|
79
64
|
attrs: {},
|
|
80
65
|
content: [
|
|
@@ -83,187 +68,123 @@ const makeChatsSocket = (config) => {
|
|
|
83
68
|
attrs: { name, value }
|
|
84
69
|
}
|
|
85
70
|
]
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
};
|
|
90
75
|
const updateMessagesPrivacy = async (value) => {
|
|
91
|
-
await privacyQuery('messages', value)
|
|
92
|
-
}
|
|
93
|
-
|
|
76
|
+
await privacyQuery('messages', value);
|
|
77
|
+
};
|
|
94
78
|
const updateCallPrivacy = async (value) => {
|
|
95
|
-
await privacyQuery('calladd', value)
|
|
96
|
-
}
|
|
97
|
-
|
|
79
|
+
await privacyQuery('calladd', value);
|
|
80
|
+
};
|
|
98
81
|
const updateLastSeenPrivacy = async (value) => {
|
|
99
|
-
await privacyQuery('last', value)
|
|
100
|
-
}
|
|
101
|
-
|
|
82
|
+
await privacyQuery('last', value);
|
|
83
|
+
};
|
|
102
84
|
const updateOnlinePrivacy = async (value) => {
|
|
103
|
-
await privacyQuery('online', value)
|
|
104
|
-
}
|
|
105
|
-
|
|
85
|
+
await privacyQuery('online', value);
|
|
86
|
+
};
|
|
106
87
|
const updateProfilePicturePrivacy = async (value) => {
|
|
107
|
-
await privacyQuery('profile', value)
|
|
108
|
-
}
|
|
109
|
-
|
|
88
|
+
await privacyQuery('profile', value);
|
|
89
|
+
};
|
|
110
90
|
const updateStatusPrivacy = async (value) => {
|
|
111
|
-
await privacyQuery('status', value)
|
|
112
|
-
}
|
|
113
|
-
|
|
91
|
+
await privacyQuery('status', value);
|
|
92
|
+
};
|
|
114
93
|
const updateReadReceiptsPrivacy = async (value) => {
|
|
115
|
-
await privacyQuery('readreceipts', value)
|
|
116
|
-
}
|
|
117
|
-
|
|
94
|
+
await privacyQuery('readreceipts', value);
|
|
95
|
+
};
|
|
118
96
|
const updateGroupsAddPrivacy = async (value) => {
|
|
119
|
-
await privacyQuery('groupadd', value)
|
|
120
|
-
}
|
|
121
|
-
|
|
97
|
+
await privacyQuery('groupadd', value);
|
|
98
|
+
};
|
|
122
99
|
const updateDefaultDisappearingMode = async (duration) => {
|
|
123
100
|
await query({
|
|
124
101
|
tag: 'iq',
|
|
125
102
|
attrs: {
|
|
126
103
|
xmlns: 'disappearing_mode',
|
|
127
|
-
to:
|
|
104
|
+
to: S_WHATSAPP_NET,
|
|
128
105
|
type: 'set'
|
|
129
106
|
},
|
|
130
|
-
content: [
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
131
109
|
tag: 'disappearing_mode',
|
|
132
110
|
attrs: {
|
|
133
111
|
duration: duration.toString()
|
|
134
112
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
139
117
|
const getBotListV2 = async () => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return botList
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const getLidUser = async (jid) => {
|
|
173
|
-
if (!jid) {
|
|
174
|
-
throw new boom_1.Boom('Please input a jid user')
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (!WABinary_1.isJidUser(jid)) {
|
|
178
|
-
throw new boom_1.Boom('Invalid JID: Not a user JID!')
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const targetJid = WABinary_1.jidNormalizedUser(jid)
|
|
182
|
-
|
|
183
|
-
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
184
|
-
usyncQuery.protocols.push({
|
|
185
|
-
name: 'lid',
|
|
186
|
-
getQueryElement: () => ({
|
|
187
|
-
tag: 'lid',
|
|
188
|
-
attrs: {},
|
|
189
|
-
content: undefined
|
|
190
|
-
}),
|
|
191
|
-
getUserElement: () => null,
|
|
192
|
-
parser: (node) => node.attrs.val
|
|
193
|
-
})
|
|
194
|
-
usyncQuery.users.push({
|
|
195
|
-
id: targetJid
|
|
196
|
-
})
|
|
197
|
-
|
|
198
|
-
const result = await Neele.executeUSyncQuery(usyncQuery)
|
|
199
|
-
|
|
200
|
-
if (result) {
|
|
201
|
-
return result.list
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const onWhatsApp = async (...jids) => {
|
|
206
|
-
const usyncQuery = new WAUSync_1.USyncQuery().withContactProtocol().withLIDProtocol()
|
|
207
|
-
|
|
208
|
-
for (const jid of jids) {
|
|
209
|
-
const phone = `+${jid.replace('+', '').split('@')[0].split(':')[0]}`
|
|
210
|
-
usyncQuery.withUser(new WAUSync_1.USyncUser().withPhone(phone))
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
const results = await Neele.executeUSyncQuery(usyncQuery)
|
|
214
|
-
|
|
215
|
-
if (results) {
|
|
216
|
-
return results.list.filter((a) => !!a.contact).map(({ contact, id, lid }) => ({ jid: id, exists: contact, lid }))
|
|
118
|
+
const resp = await query({
|
|
119
|
+
tag: 'iq',
|
|
120
|
+
attrs: {
|
|
121
|
+
xmlns: 'bot',
|
|
122
|
+
to: S_WHATSAPP_NET,
|
|
123
|
+
type: 'get'
|
|
124
|
+
},
|
|
125
|
+
content: [
|
|
126
|
+
{
|
|
127
|
+
tag: 'bot',
|
|
128
|
+
attrs: {
|
|
129
|
+
v: '2'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
const botNode = getBinaryNodeChild(resp, 'bot');
|
|
135
|
+
const botList = [];
|
|
136
|
+
for (const section of getBinaryNodeChildren(botNode, 'section')) {
|
|
137
|
+
if (section.attrs.type === 'all') {
|
|
138
|
+
for (const bot of getBinaryNodeChildren(section, 'bot')) {
|
|
139
|
+
botList.push({
|
|
140
|
+
jid: bot.attrs.jid,
|
|
141
|
+
personaId: bot.attrs['persona_id']
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
217
145
|
}
|
|
218
|
-
|
|
219
|
-
|
|
146
|
+
return botList;
|
|
147
|
+
};
|
|
220
148
|
const fetchStatus = async (...jids) => {
|
|
221
|
-
const usyncQuery = new
|
|
222
|
-
|
|
149
|
+
const usyncQuery = new USyncQuery().withStatusProtocol();
|
|
223
150
|
for (const jid of jids) {
|
|
224
|
-
usyncQuery.withUser(new
|
|
151
|
+
usyncQuery.withUser(new USyncUser().withId(jid));
|
|
225
152
|
}
|
|
226
|
-
|
|
227
|
-
const result = await Neele.executeUSyncQuery(usyncQuery)
|
|
228
|
-
|
|
153
|
+
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
229
154
|
if (result) {
|
|
230
|
-
return result.list
|
|
155
|
+
return result.list;
|
|
231
156
|
}
|
|
232
|
-
}
|
|
233
|
-
const fetchDisappearingDuration = async (...jids) => {
|
|
234
|
-
const usyncQuery = new
|
|
235
|
-
|
|
157
|
+
};
|
|
158
|
+
const fetchDisappearingDuration = async (...jids) => {
|
|
159
|
+
const usyncQuery = new USyncQuery().withDisappearingModeProtocol();
|
|
236
160
|
for (const jid of jids) {
|
|
237
|
-
usyncQuery.withUser(new
|
|
161
|
+
usyncQuery.withUser(new USyncUser().withId(jid));
|
|
238
162
|
}
|
|
239
|
-
|
|
240
|
-
const result = await Neele.executeUSyncQuery(usyncQuery)
|
|
163
|
+
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
241
164
|
if (result) {
|
|
242
|
-
return result.list
|
|
165
|
+
return result.list;
|
|
243
166
|
}
|
|
244
|
-
}
|
|
245
|
-
|
|
167
|
+
};
|
|
246
168
|
/** update the profile picture for yourself or a group */
|
|
247
|
-
const updateProfilePicture = async (jid, content) => {
|
|
248
|
-
let targetJid
|
|
249
|
-
|
|
169
|
+
const updateProfilePicture = async (jid, content, dimensions) => {
|
|
170
|
+
let targetJid;
|
|
250
171
|
if (!jid) {
|
|
251
|
-
throw new
|
|
172
|
+
throw new Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
173
|
+
}
|
|
174
|
+
if (jidNormalizedUser(jid) !== jidNormalizedUser(authState.creds.me.id)) {
|
|
175
|
+
targetJid = jidNormalizedUser(jid); // in case it is someone other than us
|
|
252
176
|
}
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
targetJid = WABinary_1.jidNormalizedUser(jid) // in case it is someone other than us
|
|
177
|
+
else {
|
|
178
|
+
targetJid = undefined;
|
|
256
179
|
}
|
|
257
|
-
|
|
258
|
-
const { img } = await Utils_1.generateProfilePicture(content)
|
|
259
|
-
|
|
180
|
+
const { img } = await generateProfilePicture(content, dimensions);
|
|
260
181
|
await query({
|
|
261
182
|
tag: 'iq',
|
|
262
183
|
attrs: {
|
|
263
|
-
|
|
264
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
184
|
+
to: S_WHATSAPP_NET,
|
|
265
185
|
type: 'set',
|
|
266
|
-
xmlns: 'w:profile:picture'
|
|
186
|
+
xmlns: 'w:profile:picture',
|
|
187
|
+
...(targetJid ? { target: targetJid } : {})
|
|
267
188
|
},
|
|
268
189
|
content: [
|
|
269
190
|
{
|
|
@@ -272,38 +193,36 @@ const makeChatsSocket = (config) => {
|
|
|
272
193
|
content: img
|
|
273
194
|
}
|
|
274
195
|
]
|
|
275
|
-
})
|
|
276
|
-
}
|
|
277
|
-
|
|
196
|
+
});
|
|
197
|
+
};
|
|
278
198
|
/** remove the profile picture for yourself or a group */
|
|
279
199
|
const removeProfilePicture = async (jid) => {
|
|
280
|
-
let targetJid
|
|
281
|
-
|
|
200
|
+
let targetJid;
|
|
282
201
|
if (!jid) {
|
|
283
|
-
throw new
|
|
202
|
+
throw new Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
203
|
+
}
|
|
204
|
+
if (jidNormalizedUser(jid) !== jidNormalizedUser(authState.creds.me.id)) {
|
|
205
|
+
targetJid = jidNormalizedUser(jid); // in case it is someone other than us
|
|
284
206
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
targetJid = WABinary_1.jidNormalizedUser(jid) // in case it is someone other than us
|
|
207
|
+
else {
|
|
208
|
+
targetJid = undefined;
|
|
288
209
|
}
|
|
289
|
-
|
|
290
210
|
await query({
|
|
291
211
|
tag: 'iq',
|
|
292
212
|
attrs: {
|
|
293
|
-
|
|
294
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
213
|
+
to: S_WHATSAPP_NET,
|
|
295
214
|
type: 'set',
|
|
296
|
-
xmlns: 'w:profile:picture'
|
|
215
|
+
xmlns: 'w:profile:picture',
|
|
216
|
+
...(targetJid ? { target: targetJid } : {})
|
|
297
217
|
}
|
|
298
|
-
})
|
|
299
|
-
}
|
|
300
|
-
|
|
218
|
+
});
|
|
219
|
+
};
|
|
301
220
|
/** update the profile status for yourself */
|
|
302
221
|
const updateProfileStatus = async (status) => {
|
|
303
222
|
await query({
|
|
304
223
|
tag: 'iq',
|
|
305
224
|
attrs: {
|
|
306
|
-
to:
|
|
225
|
+
to: S_WHATSAPP_NET,
|
|
307
226
|
type: 'set',
|
|
308
227
|
xmlns: 'status'
|
|
309
228
|
},
|
|
@@ -314,34 +233,29 @@ const makeChatsSocket = (config) => {
|
|
|
314
233
|
content: Buffer.from(status, 'utf-8')
|
|
315
234
|
}
|
|
316
235
|
]
|
|
317
|
-
})
|
|
318
|
-
}
|
|
319
|
-
|
|
236
|
+
});
|
|
237
|
+
};
|
|
320
238
|
const updateProfileName = async (name) => {
|
|
321
|
-
await chatModify({ pushNameSetting: name }, '')
|
|
322
|
-
}
|
|
323
|
-
|
|
239
|
+
await chatModify({ pushNameSetting: name }, '');
|
|
240
|
+
};
|
|
324
241
|
const fetchBlocklist = async () => {
|
|
325
242
|
const result = await query({
|
|
326
243
|
tag: 'iq',
|
|
327
244
|
attrs: {
|
|
328
245
|
xmlns: 'blocklist',
|
|
329
|
-
to:
|
|
246
|
+
to: S_WHATSAPP_NET,
|
|
330
247
|
type: 'get'
|
|
331
248
|
}
|
|
332
|
-
})
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
return WABinary_1.getBinaryNodeChildren(listNode, 'item').map((n) => n.attrs.jid)
|
|
337
|
-
}
|
|
338
|
-
|
|
249
|
+
});
|
|
250
|
+
const listNode = getBinaryNodeChild(result, 'list');
|
|
251
|
+
return getBinaryNodeChildren(listNode, 'item').map(n => n.attrs.jid);
|
|
252
|
+
};
|
|
339
253
|
const updateBlockStatus = async (jid, action) => {
|
|
340
254
|
await query({
|
|
341
255
|
tag: 'iq',
|
|
342
256
|
attrs: {
|
|
343
257
|
xmlns: 'blocklist',
|
|
344
|
-
to:
|
|
258
|
+
to: S_WHATSAPP_NET,
|
|
345
259
|
type: 'set'
|
|
346
260
|
},
|
|
347
261
|
content: [
|
|
@@ -353,9 +267,8 @@ const makeChatsSocket = (config) => {
|
|
|
353
267
|
}
|
|
354
268
|
}
|
|
355
269
|
]
|
|
356
|
-
})
|
|
357
|
-
}
|
|
358
|
-
|
|
270
|
+
});
|
|
271
|
+
};
|
|
359
272
|
const getBusinessProfile = async (jid) => {
|
|
360
273
|
const results = await query({
|
|
361
274
|
tag: 'iq',
|
|
@@ -364,121 +277,116 @@ const makeChatsSocket = (config) => {
|
|
|
364
277
|
xmlns: 'w:biz',
|
|
365
278
|
type: 'get'
|
|
366
279
|
},
|
|
367
|
-
content: [
|
|
280
|
+
content: [
|
|
281
|
+
{
|
|
368
282
|
tag: 'business_profile',
|
|
369
283
|
attrs: { v: '244' },
|
|
370
|
-
content: [
|
|
284
|
+
content: [
|
|
285
|
+
{
|
|
371
286
|
tag: 'profile',
|
|
372
287
|
attrs: { jid }
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const profiles =
|
|
380
|
-
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
});
|
|
293
|
+
const profileNode = getBinaryNodeChild(results, 'business_profile');
|
|
294
|
+
const profiles = getBinaryNodeChild(profileNode, 'profile');
|
|
381
295
|
if (profiles) {
|
|
382
|
-
const address =
|
|
383
|
-
const description =
|
|
384
|
-
const website =
|
|
385
|
-
const email =
|
|
386
|
-
const category =
|
|
387
|
-
const businessHours =
|
|
296
|
+
const address = getBinaryNodeChild(profiles, 'address');
|
|
297
|
+
const description = getBinaryNodeChild(profiles, 'description');
|
|
298
|
+
const website = getBinaryNodeChild(profiles, 'website');
|
|
299
|
+
const email = getBinaryNodeChild(profiles, 'email');
|
|
300
|
+
const category = getBinaryNodeChild(getBinaryNodeChild(profiles, 'categories'), 'category');
|
|
301
|
+
const businessHours = getBinaryNodeChild(profiles, 'business_hours');
|
|
388
302
|
const businessHoursConfig = businessHours
|
|
389
|
-
?
|
|
390
|
-
: undefined
|
|
391
|
-
const websiteStr = website?.content?.toString()
|
|
392
|
-
|
|
303
|
+
? getBinaryNodeChildren(businessHours, 'business_hours_config')
|
|
304
|
+
: undefined;
|
|
305
|
+
const websiteStr = website?.content?.toString();
|
|
393
306
|
return {
|
|
394
|
-
wid: profiles
|
|
307
|
+
wid: profiles.attrs?.jid,
|
|
395
308
|
address: address?.content?.toString(),
|
|
396
309
|
description: description?.content?.toString() || '',
|
|
397
310
|
website: websiteStr ? [websiteStr] : [],
|
|
398
311
|
email: email?.content?.toString(),
|
|
399
312
|
category: category?.content?.toString(),
|
|
400
|
-
|
|
313
|
+
business_hours: {
|
|
401
314
|
timezone: businessHours?.attrs?.timezone,
|
|
402
|
-
|
|
315
|
+
business_config: businessHoursConfig?.map(({ attrs }) => attrs)
|
|
403
316
|
}
|
|
404
|
-
}
|
|
317
|
+
};
|
|
405
318
|
}
|
|
406
|
-
}
|
|
407
|
-
|
|
319
|
+
};
|
|
408
320
|
const cleanDirtyBits = async (type, fromTimestamp) => {
|
|
409
|
-
logger.info({ fromTimestamp }, 'clean dirty bits ' + type)
|
|
321
|
+
logger.info({ fromTimestamp }, 'clean dirty bits ' + type);
|
|
410
322
|
await sendNode({
|
|
411
323
|
tag: 'iq',
|
|
412
324
|
attrs: {
|
|
413
|
-
to:
|
|
325
|
+
to: S_WHATSAPP_NET,
|
|
414
326
|
type: 'set',
|
|
415
327
|
xmlns: 'urn:xmpp:whatsapp:dirty',
|
|
416
|
-
id: generateMessageTag()
|
|
328
|
+
id: generateMessageTag()
|
|
417
329
|
},
|
|
418
330
|
content: [
|
|
419
331
|
{
|
|
420
332
|
tag: 'clean',
|
|
421
333
|
attrs: {
|
|
422
334
|
type,
|
|
423
|
-
...(fromTimestamp ? { timestamp: fromTimestamp.toString() } : null)
|
|
335
|
+
...(fromTimestamp ? { timestamp: fromTimestamp.toString() } : null)
|
|
424
336
|
}
|
|
425
337
|
}
|
|
426
338
|
]
|
|
427
|
-
})
|
|
428
|
-
}
|
|
429
|
-
|
|
339
|
+
});
|
|
340
|
+
};
|
|
430
341
|
const newAppStateChunkHandler = (isInitialSync) => {
|
|
431
342
|
return {
|
|
432
343
|
onMutation(mutation) {
|
|
433
|
-
|
|
344
|
+
processSyncAction(mutation, ev, authState.creds.me, isInitialSync ? { accountSettings: authState.creds.accountSettings } : undefined, logger);
|
|
434
345
|
}
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
346
|
+
};
|
|
347
|
+
};
|
|
438
348
|
const resyncAppState = ev.createBufferedFunction(async (collections, isInitialSync) => {
|
|
439
349
|
// we use this to determine which events to fire
|
|
440
350
|
// otherwise when we resync from scratch -- all notifications will fire
|
|
441
|
-
const initialVersionMap = {}
|
|
442
|
-
const globalMutationMap = {}
|
|
351
|
+
const initialVersionMap = {};
|
|
352
|
+
const globalMutationMap = {};
|
|
443
353
|
await authState.keys.transaction(async () => {
|
|
444
|
-
const collectionsToHandle = new Set(collections)
|
|
354
|
+
const collectionsToHandle = new Set(collections);
|
|
445
355
|
// in case something goes wrong -- ensure we don't enter a loop that cannot be exited from
|
|
446
|
-
const attemptsMap = {}
|
|
356
|
+
const attemptsMap = {};
|
|
447
357
|
// keep executing till all collections are done
|
|
448
358
|
// sometimes a single patch request will not return all the patches (God knows why)
|
|
449
359
|
// so we fetch till they're all done (this is determined by the "has_more_patches" flag)
|
|
450
360
|
while (collectionsToHandle.size) {
|
|
451
|
-
const states = {}
|
|
452
|
-
const nodes = []
|
|
453
|
-
|
|
361
|
+
const states = {};
|
|
362
|
+
const nodes = [];
|
|
454
363
|
for (const name of collectionsToHandle) {
|
|
455
|
-
const result = await authState.keys.get('app-state-sync-version', [name])
|
|
456
|
-
let state = result[name]
|
|
364
|
+
const result = await authState.keys.get('app-state-sync-version', [name]);
|
|
365
|
+
let state = result[name];
|
|
457
366
|
if (state) {
|
|
458
367
|
if (typeof initialVersionMap[name] === 'undefined') {
|
|
459
|
-
initialVersionMap[name] = state.version
|
|
368
|
+
initialVersionMap[name] = state.version;
|
|
460
369
|
}
|
|
461
370
|
}
|
|
462
371
|
else {
|
|
463
|
-
state =
|
|
372
|
+
state = newLTHashState();
|
|
464
373
|
}
|
|
465
|
-
states[name] = state
|
|
466
|
-
logger.info(`resyncing ${name} from v${state.version}`)
|
|
374
|
+
states[name] = state;
|
|
375
|
+
logger.info(`resyncing ${name} from v${state.version}`);
|
|
467
376
|
nodes.push({
|
|
468
377
|
tag: 'collection',
|
|
469
378
|
attrs: {
|
|
470
379
|
name,
|
|
471
380
|
version: state.version.toString(),
|
|
472
381
|
// return snapshot if being synced from scratch
|
|
473
|
-
|
|
382
|
+
return_snapshot: (!state.version).toString()
|
|
474
383
|
}
|
|
475
|
-
})
|
|
384
|
+
});
|
|
476
385
|
}
|
|
477
|
-
|
|
478
386
|
const result = await query({
|
|
479
387
|
tag: 'iq',
|
|
480
388
|
attrs: {
|
|
481
|
-
to:
|
|
389
|
+
to: S_WHATSAPP_NET,
|
|
482
390
|
xmlns: 'w:sync:app:state',
|
|
483
391
|
type: 'set'
|
|
484
392
|
},
|
|
@@ -489,125 +397,121 @@ const makeChatsSocket = (config) => {
|
|
|
489
397
|
content: nodes
|
|
490
398
|
}
|
|
491
399
|
]
|
|
492
|
-
})
|
|
493
|
-
|
|
400
|
+
});
|
|
494
401
|
// extract from binary node
|
|
495
|
-
const decoded = await
|
|
496
|
-
|
|
402
|
+
const decoded = await extractSyncdPatches(result, config?.options);
|
|
497
403
|
for (const key in decoded) {
|
|
498
|
-
const name = key
|
|
499
|
-
const { patches, hasMorePatches, snapshot } = decoded[name]
|
|
404
|
+
const name = key;
|
|
405
|
+
const { patches, hasMorePatches, snapshot } = decoded[name];
|
|
500
406
|
try {
|
|
501
407
|
if (snapshot) {
|
|
502
|
-
const { state: newState, mutationMap } = await
|
|
503
|
-
states[name] = newState
|
|
504
|
-
Object.assign(globalMutationMap, mutationMap)
|
|
505
|
-
logger.info(`restored state of ${name} from snapshot to v${newState.version} with mutations`)
|
|
506
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } })
|
|
408
|
+
const { state: newState, mutationMap } = await decodeSyncdSnapshot(name, snapshot, getAppStateSyncKey, initialVersionMap[name], appStateMacVerification.snapshot);
|
|
409
|
+
states[name] = newState;
|
|
410
|
+
Object.assign(globalMutationMap, mutationMap);
|
|
411
|
+
logger.info(`restored state of ${name} from snapshot to v${newState.version} with mutations`);
|
|
412
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } });
|
|
507
413
|
}
|
|
508
|
-
|
|
509
414
|
// only process if there are syncd patches
|
|
510
415
|
if (patches.length) {
|
|
511
|
-
const { state: newState, mutationMap } = await
|
|
512
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } })
|
|
513
|
-
logger.info(`synced ${name} to v${newState.version}`)
|
|
514
|
-
initialVersionMap[name] = newState.version
|
|
515
|
-
Object.assign(globalMutationMap, mutationMap)
|
|
416
|
+
const { state: newState, mutationMap } = await decodePatches(name, patches, states[name], getAppStateSyncKey, config.options, initialVersionMap[name], logger, appStateMacVerification.patch);
|
|
417
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } });
|
|
418
|
+
logger.info(`synced ${name} to v${newState.version}`);
|
|
419
|
+
initialVersionMap[name] = newState.version;
|
|
420
|
+
Object.assign(globalMutationMap, mutationMap);
|
|
516
421
|
}
|
|
517
|
-
|
|
518
422
|
if (hasMorePatches) {
|
|
519
|
-
logger.info(`${name} has more patches...`)
|
|
520
|
-
}
|
|
521
|
-
else { // collection is done with sync
|
|
522
|
-
collectionsToHandle.delete(name)
|
|
423
|
+
logger.info(`${name} has more patches...`);
|
|
523
424
|
}
|
|
524
|
-
|
|
425
|
+
else {
|
|
426
|
+
// collection is done with sync
|
|
427
|
+
collectionsToHandle.delete(name);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
525
430
|
catch (error) {
|
|
526
431
|
// if retry attempts overshoot
|
|
527
432
|
// or key not found
|
|
528
|
-
const isIrrecoverableError = attemptsMap[name] >= MAX_SYNC_ATTEMPTS
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`)
|
|
532
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: null } })
|
|
433
|
+
const isIrrecoverableError = attemptsMap[name] >= MAX_SYNC_ATTEMPTS ||
|
|
434
|
+
error.output?.statusCode === 404 ||
|
|
435
|
+
error.name === 'TypeError';
|
|
436
|
+
logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`);
|
|
437
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: null } });
|
|
533
438
|
// increment number of retries
|
|
534
|
-
attemptsMap[name] = (attemptsMap[name] || 0) + 1
|
|
535
|
-
|
|
439
|
+
attemptsMap[name] = (attemptsMap[name] || 0) + 1;
|
|
536
440
|
if (isIrrecoverableError) {
|
|
537
441
|
// stop retrying
|
|
538
|
-
collectionsToHandle.delete(name)
|
|
442
|
+
collectionsToHandle.delete(name);
|
|
539
443
|
}
|
|
540
444
|
}
|
|
541
445
|
}
|
|
542
446
|
}
|
|
543
|
-
})
|
|
544
|
-
|
|
545
|
-
const { onMutation } = newAppStateChunkHandler(isInitialSync)
|
|
546
|
-
|
|
447
|
+
}, authState?.creds?.me?.id || 'resync-app-state');
|
|
448
|
+
const { onMutation } = newAppStateChunkHandler(isInitialSync);
|
|
547
449
|
for (const key in globalMutationMap) {
|
|
548
|
-
onMutation(globalMutationMap[key])
|
|
450
|
+
onMutation(globalMutationMap[key]);
|
|
549
451
|
}
|
|
550
|
-
})
|
|
551
|
-
|
|
552
|
-
|
|
452
|
+
});
|
|
453
|
+
/**
|
|
454
|
+
* fetch the profile picture of a user/group
|
|
455
|
+
* type = "preview" for a low res picture
|
|
456
|
+
* type = "image for the high res picture"
|
|
457
|
+
*/
|
|
458
|
+
const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
|
|
459
|
+
// TOOD: Add support for tctoken, existingID, and newsletter + group options
|
|
460
|
+
jid = jidNormalizedUser(jid);
|
|
461
|
+
const result = await query({
|
|
462
|
+
tag: 'iq',
|
|
463
|
+
attrs: {
|
|
464
|
+
target: jid,
|
|
465
|
+
to: S_WHATSAPP_NET,
|
|
466
|
+
type: 'get',
|
|
467
|
+
xmlns: 'w:profile:picture'
|
|
468
|
+
},
|
|
469
|
+
content: [{ tag: 'picture', attrs: { type, query: 'url' } }]
|
|
470
|
+
}, timeoutMs);
|
|
471
|
+
const child = getBinaryNodeChild(result, 'picture');
|
|
472
|
+
return child?.attrs?.url;
|
|
473
|
+
};
|
|
553
474
|
const createCallLink = async (type, event, timeoutMs) => {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
content: event ? [{
|
|
572
|
-
tag: 'event',
|
|
573
|
-
attrs: {
|
|
574
|
-
start_time: String(event)
|
|
575
|
-
}
|
|
576
|
-
}] : undefined
|
|
577
|
-
}]
|
|
578
|
-
}, timeoutMs)
|
|
579
|
-
|
|
580
|
-
const child = WABinary_1.getBinaryNodeChild(result, 'link_create')
|
|
581
|
-
const token = child?.attrs?.token
|
|
582
|
-
|
|
583
|
-
return type === 'audio' ? Defaults_1.CALL_AUDIO_PREFIX + token : Defaults_1.CALL_VIDEO_PREFIX + token
|
|
584
|
-
}
|
|
585
|
-
|
|
475
|
+
const result = await query({
|
|
476
|
+
tag: 'call',
|
|
477
|
+
attrs: {
|
|
478
|
+
id: generateMessageTag(),
|
|
479
|
+
to: '@call'
|
|
480
|
+
},
|
|
481
|
+
content: [
|
|
482
|
+
{
|
|
483
|
+
tag: 'link_create',
|
|
484
|
+
attrs: { media: type },
|
|
485
|
+
content: event ? [{ tag: 'event', attrs: { start_time: String(event.startTime) } }] : undefined
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
}, timeoutMs);
|
|
489
|
+
const child = getBinaryNodeChild(result, 'link_create');
|
|
490
|
+
return child?.attrs?.token;
|
|
491
|
+
};
|
|
586
492
|
const sendPresenceUpdate = async (type, toJid) => {
|
|
587
|
-
const me = authState.creds.me
|
|
588
|
-
|
|
493
|
+
const me = authState.creds.me;
|
|
589
494
|
if (type === 'available' || type === 'unavailable') {
|
|
590
495
|
if (!me.name) {
|
|
591
|
-
logger.warn('no name present, ignoring presence update request...')
|
|
592
|
-
return
|
|
496
|
+
logger.warn('no name present, ignoring presence update request...');
|
|
497
|
+
return;
|
|
593
498
|
}
|
|
594
|
-
|
|
595
|
-
ev.emit('connection.update', { isOnline: type === 'available' })
|
|
499
|
+
ev.emit('connection.update', { isOnline: type === 'available' });
|
|
596
500
|
await sendNode({
|
|
597
501
|
tag: 'presence',
|
|
598
502
|
attrs: {
|
|
599
503
|
name: me.name.replace(/@/g, ''),
|
|
600
504
|
type
|
|
601
505
|
}
|
|
602
|
-
})
|
|
506
|
+
});
|
|
603
507
|
}
|
|
604
508
|
else {
|
|
605
|
-
|
|
606
|
-
|
|
509
|
+
const { server } = jidDecode(toJid);
|
|
510
|
+
const isLid = server === 'lid';
|
|
607
511
|
await sendNode({
|
|
608
512
|
tag: 'chatstate',
|
|
609
513
|
attrs: {
|
|
610
|
-
from:
|
|
514
|
+
from: isLid ? me.lid : me.id,
|
|
611
515
|
to: toJid
|
|
612
516
|
},
|
|
613
517
|
content: [
|
|
@@ -616,15 +520,14 @@ const makeChatsSocket = (config) => {
|
|
|
616
520
|
attrs: type === 'recording' ? { media: 'audio' } : {}
|
|
617
521
|
}
|
|
618
522
|
]
|
|
619
|
-
})
|
|
523
|
+
});
|
|
620
524
|
}
|
|
621
|
-
}
|
|
622
|
-
|
|
525
|
+
};
|
|
623
526
|
/**
|
|
624
527
|
* @param toJid the jid to subscribe to
|
|
625
528
|
* @param tcToken token for subscription, use if present
|
|
626
529
|
*/
|
|
627
|
-
const presenceSubscribe = (toJid, tcToken) =>
|
|
530
|
+
const presenceSubscribe = (toJid, tcToken) => sendNode({
|
|
628
531
|
tag: 'presence',
|
|
629
532
|
attrs: {
|
|
630
533
|
to: toJid,
|
|
@@ -640,72 +543,58 @@ const makeChatsSocket = (config) => {
|
|
|
640
543
|
}
|
|
641
544
|
]
|
|
642
545
|
: undefined
|
|
643
|
-
})
|
|
644
|
-
|
|
546
|
+
});
|
|
645
547
|
const handlePresenceUpdate = ({ tag, attrs, content }) => {
|
|
646
|
-
let presence
|
|
647
|
-
const jid = attrs.from
|
|
648
|
-
const participant = attrs.participant || attrs.from
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
return
|
|
548
|
+
let presence;
|
|
549
|
+
const jid = attrs.from;
|
|
550
|
+
const participant = attrs.participant || attrs.from;
|
|
551
|
+
if (shouldIgnoreJid(jid) && jid !== S_WHATSAPP_NET) {
|
|
552
|
+
return;
|
|
652
553
|
}
|
|
653
|
-
|
|
654
554
|
if (tag === 'presence') {
|
|
655
555
|
presence = {
|
|
656
556
|
lastKnownPresence: attrs.type === 'unavailable' ? 'unavailable' : 'available',
|
|
657
557
|
lastSeen: attrs.last && attrs.last !== 'deny' ? +attrs.last : undefined
|
|
658
|
-
}
|
|
558
|
+
};
|
|
659
559
|
}
|
|
660
|
-
|
|
661
560
|
else if (Array.isArray(content)) {
|
|
662
|
-
const [firstChild] = content
|
|
663
|
-
let type = firstChild.tag
|
|
664
|
-
|
|
561
|
+
const [firstChild] = content;
|
|
562
|
+
let type = firstChild.tag;
|
|
665
563
|
if (type === 'paused') {
|
|
666
|
-
type = 'available'
|
|
564
|
+
type = 'available';
|
|
667
565
|
}
|
|
668
|
-
|
|
669
566
|
if (firstChild.attrs?.media === 'audio') {
|
|
670
|
-
type = 'recording'
|
|
567
|
+
type = 'recording';
|
|
671
568
|
}
|
|
672
|
-
|
|
673
|
-
presence = { lastKnownPresence: type }
|
|
569
|
+
presence = { lastKnownPresence: type };
|
|
674
570
|
}
|
|
675
|
-
|
|
676
571
|
else {
|
|
677
|
-
logger.error({ tag, attrs, content }, 'recv invalid presence node')
|
|
572
|
+
logger.error({ tag, attrs, content }, 'recv invalid presence node');
|
|
678
573
|
}
|
|
679
|
-
|
|
680
574
|
if (presence) {
|
|
681
|
-
ev.emit('presence.update', { id: jid, presences: { [participant]: presence } })
|
|
575
|
+
ev.emit('presence.update', { id: jid, presences: { [participant]: presence } });
|
|
682
576
|
}
|
|
683
|
-
}
|
|
684
|
-
|
|
577
|
+
};
|
|
685
578
|
const appPatch = async (patchCreate) => {
|
|
686
|
-
const name = patchCreate.type
|
|
687
|
-
const myAppStateKeyId = authState.creds.myAppStateKeyId
|
|
688
|
-
|
|
579
|
+
const name = patchCreate.type;
|
|
580
|
+
const myAppStateKeyId = authState.creds.myAppStateKeyId;
|
|
689
581
|
if (!myAppStateKeyId) {
|
|
690
|
-
throw new
|
|
582
|
+
throw new Boom('App state key not present!', { statusCode: 400 });
|
|
691
583
|
}
|
|
692
|
-
|
|
693
|
-
let
|
|
694
|
-
let encodeResult
|
|
695
|
-
|
|
584
|
+
let initial;
|
|
585
|
+
let encodeResult;
|
|
696
586
|
await processingMutex.mutex(async () => {
|
|
697
587
|
await authState.keys.transaction(async () => {
|
|
698
|
-
logger.debug({ patch: patchCreate }, 'applying app patch')
|
|
699
|
-
await resyncAppState([name], false)
|
|
700
|
-
const { [name]: currentSyncVersion } = await authState.keys.get('app-state-sync-version', [name])
|
|
701
|
-
initial = currentSyncVersion ||
|
|
702
|
-
encodeResult = await
|
|
703
|
-
const { patch, state } = encodeResult
|
|
704
|
-
|
|
588
|
+
logger.debug({ patch: patchCreate }, 'applying app patch');
|
|
589
|
+
await resyncAppState([name], false);
|
|
590
|
+
const { [name]: currentSyncVersion } = await authState.keys.get('app-state-sync-version', [name]);
|
|
591
|
+
initial = currentSyncVersion || newLTHashState();
|
|
592
|
+
encodeResult = await encodeSyncdPatch(patchCreate, myAppStateKeyId, initial, getAppStateSyncKey);
|
|
593
|
+
const { patch, state } = encodeResult;
|
|
705
594
|
const node = {
|
|
706
595
|
tag: 'iq',
|
|
707
596
|
attrs: {
|
|
708
|
-
to:
|
|
597
|
+
to: S_WHATSAPP_NET,
|
|
709
598
|
type: 'set',
|
|
710
599
|
xmlns: 'w:sync:app:state'
|
|
711
600
|
},
|
|
@@ -719,88 +608,82 @@ const makeChatsSocket = (config) => {
|
|
|
719
608
|
attrs: {
|
|
720
609
|
name,
|
|
721
610
|
version: (state.version - 1).toString(),
|
|
722
|
-
|
|
611
|
+
return_snapshot: 'false'
|
|
723
612
|
},
|
|
724
613
|
content: [
|
|
725
614
|
{
|
|
726
615
|
tag: 'patch',
|
|
727
616
|
attrs: {},
|
|
728
|
-
content:
|
|
617
|
+
content: proto.SyncdPatch.encode(patch).finish()
|
|
729
618
|
}
|
|
730
619
|
]
|
|
731
620
|
}
|
|
732
621
|
]
|
|
733
622
|
}
|
|
734
623
|
]
|
|
735
|
-
}
|
|
736
|
-
await query(node)
|
|
737
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: state } })
|
|
738
|
-
})
|
|
739
|
-
})
|
|
740
|
-
|
|
624
|
+
};
|
|
625
|
+
await query(node);
|
|
626
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: state } });
|
|
627
|
+
}, authState?.creds?.me?.id || 'app-patch');
|
|
628
|
+
});
|
|
741
629
|
if (config.emitOwnEvents) {
|
|
742
|
-
const { onMutation } = newAppStateChunkHandler(false)
|
|
743
|
-
const { mutationMap } = await
|
|
744
|
-
|
|
630
|
+
const { onMutation } = newAppStateChunkHandler(false);
|
|
631
|
+
const { mutationMap } = await decodePatches(name, [{ ...encodeResult.patch, version: { version: encodeResult.state.version } }], initial, getAppStateSyncKey, config.options, undefined, logger);
|
|
745
632
|
for (const key in mutationMap) {
|
|
746
|
-
onMutation(mutationMap[key])
|
|
633
|
+
onMutation(mutationMap[key]);
|
|
747
634
|
}
|
|
748
635
|
}
|
|
749
|
-
}
|
|
750
|
-
|
|
636
|
+
};
|
|
751
637
|
/** sending non-abt props may fix QR scan fail if server expects */
|
|
752
638
|
const fetchProps = async () => {
|
|
639
|
+
//TODO: implement both protocol 1 and protocol 2 prop fetching, specially for abKey for WM
|
|
753
640
|
const resultNode = await query({
|
|
754
641
|
tag: 'iq',
|
|
755
642
|
attrs: {
|
|
756
|
-
to:
|
|
643
|
+
to: S_WHATSAPP_NET,
|
|
757
644
|
xmlns: 'w',
|
|
758
|
-
type: 'get'
|
|
645
|
+
type: 'get'
|
|
759
646
|
},
|
|
760
647
|
content: [
|
|
761
|
-
{
|
|
648
|
+
{
|
|
649
|
+
tag: 'props',
|
|
650
|
+
attrs: {
|
|
762
651
|
protocol: '2',
|
|
763
652
|
hash: authState?.creds?.lastPropHash || ''
|
|
764
|
-
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
765
655
|
]
|
|
766
|
-
})
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
let props = {}
|
|
770
|
-
|
|
656
|
+
});
|
|
657
|
+
const propsNode = getBinaryNodeChild(resultNode, 'props');
|
|
658
|
+
let props = {};
|
|
771
659
|
if (propsNode) {
|
|
772
|
-
if (propsNode.attrs?.hash) {
|
|
773
|
-
|
|
774
|
-
|
|
660
|
+
if (propsNode.attrs?.hash) {
|
|
661
|
+
// on some clients, the hash is returning as undefined
|
|
662
|
+
authState.creds.lastPropHash = propsNode?.attrs?.hash;
|
|
663
|
+
ev.emit('creds.update', authState.creds);
|
|
775
664
|
}
|
|
776
|
-
|
|
777
|
-
props = WABinary_1.reduceBinaryNodeToDictionary(propsNode, 'prop')
|
|
665
|
+
props = reduceBinaryNodeToDictionary(propsNode, 'prop');
|
|
778
666
|
}
|
|
779
|
-
logger.debug('fetched props')
|
|
780
|
-
return props
|
|
781
|
-
}
|
|
782
|
-
|
|
667
|
+
logger.debug('fetched props');
|
|
668
|
+
return props;
|
|
669
|
+
};
|
|
783
670
|
/**
|
|
784
671
|
* modify a chat -- mark unread, read etc.
|
|
785
672
|
* lastMessages must be sorted in reverse chronologically
|
|
786
|
-
* requires the last messages till the last message received required for archive & unread
|
|
787
|
-
|
|
673
|
+
* requires the last messages till the last message received; required for archive & unread
|
|
674
|
+
*/
|
|
788
675
|
const chatModify = (mod, jid) => {
|
|
789
|
-
const patch =
|
|
790
|
-
return appPatch(patch)
|
|
791
|
-
}
|
|
792
|
-
|
|
676
|
+
const patch = chatModificationToAppPatch(mod, jid);
|
|
677
|
+
return appPatch(patch);
|
|
678
|
+
};
|
|
793
679
|
/**
|
|
794
680
|
* Enable/Disable link preview privacy, not related to baileys link preview generation
|
|
795
681
|
*/
|
|
796
682
|
const updateDisableLinkPreviewsPrivacy = (isPreviewsDisabled) => {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
}, '')
|
|
802
|
-
}
|
|
803
|
-
|
|
683
|
+
return chatModify({
|
|
684
|
+
disableLinkPreviews: { isPreviewsDisabled }
|
|
685
|
+
}, '');
|
|
686
|
+
};
|
|
804
687
|
/**
|
|
805
688
|
* Star or Unstar a message
|
|
806
689
|
*/
|
|
@@ -810,27 +693,24 @@ const makeChatsSocket = (config) => {
|
|
|
810
693
|
messages,
|
|
811
694
|
star
|
|
812
695
|
}
|
|
813
|
-
}, jid)
|
|
814
|
-
}
|
|
815
|
-
|
|
696
|
+
}, jid);
|
|
697
|
+
};
|
|
816
698
|
/**
|
|
817
|
-
* Add
|
|
699
|
+
* Add or Edit Contact
|
|
818
700
|
*/
|
|
819
701
|
const addOrEditContact = (jid, contact) => {
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
}, jid)
|
|
823
|
-
}
|
|
824
|
-
|
|
702
|
+
return chatModify({
|
|
703
|
+
contact
|
|
704
|
+
}, jid);
|
|
705
|
+
};
|
|
825
706
|
/**
|
|
826
707
|
* Remove Contact
|
|
827
708
|
*/
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
709
|
+
const removeContact = (jid) => {
|
|
710
|
+
return chatModify({
|
|
711
|
+
contact: null
|
|
712
|
+
}, jid);
|
|
713
|
+
};
|
|
834
714
|
/**
|
|
835
715
|
* Adds label
|
|
836
716
|
*/
|
|
@@ -839,9 +719,8 @@ const makeChatsSocket = (config) => {
|
|
|
839
719
|
addLabel: {
|
|
840
720
|
...labels
|
|
841
721
|
}
|
|
842
|
-
}, jid)
|
|
843
|
-
}
|
|
844
|
-
|
|
722
|
+
}, jid);
|
|
723
|
+
};
|
|
845
724
|
/**
|
|
846
725
|
* Adds label for the chats
|
|
847
726
|
*/
|
|
@@ -850,9 +729,8 @@ const makeChatsSocket = (config) => {
|
|
|
850
729
|
addChatLabel: {
|
|
851
730
|
labelId
|
|
852
731
|
}
|
|
853
|
-
}, jid)
|
|
854
|
-
}
|
|
855
|
-
|
|
732
|
+
}, jid);
|
|
733
|
+
};
|
|
856
734
|
/**
|
|
857
735
|
* Removes label for the chat
|
|
858
736
|
*/
|
|
@@ -861,9 +739,8 @@ const makeChatsSocket = (config) => {
|
|
|
861
739
|
removeChatLabel: {
|
|
862
740
|
labelId
|
|
863
741
|
}
|
|
864
|
-
}, jid)
|
|
865
|
-
}
|
|
866
|
-
|
|
742
|
+
}, jid);
|
|
743
|
+
};
|
|
867
744
|
/**
|
|
868
745
|
* Adds label for the message
|
|
869
746
|
*/
|
|
@@ -873,9 +750,8 @@ const makeChatsSocket = (config) => {
|
|
|
873
750
|
messageId,
|
|
874
751
|
labelId
|
|
875
752
|
}
|
|
876
|
-
}, jid)
|
|
877
|
-
}
|
|
878
|
-
|
|
753
|
+
}, jid);
|
|
754
|
+
};
|
|
879
755
|
/**
|
|
880
756
|
* Removes label for the message
|
|
881
757
|
*/
|
|
@@ -885,198 +761,170 @@ const makeChatsSocket = (config) => {
|
|
|
885
761
|
messageId,
|
|
886
762
|
labelId
|
|
887
763
|
}
|
|
888
|
-
}, jid)
|
|
889
|
-
}
|
|
890
|
-
|
|
764
|
+
}, jid);
|
|
765
|
+
};
|
|
891
766
|
/**
|
|
892
|
-
*
|
|
767
|
+
* Add or Edit Quick Reply
|
|
893
768
|
*/
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
769
|
+
const addOrEditQuickReply = (quickReply) => {
|
|
770
|
+
return chatModify({
|
|
771
|
+
quickReply
|
|
772
|
+
}, '');
|
|
773
|
+
};
|
|
774
|
+
/**
|
|
775
|
+
* Remove Quick Reply
|
|
776
|
+
*/
|
|
777
|
+
const removeQuickReply = (timestamp) => {
|
|
778
|
+
return chatModify({
|
|
779
|
+
quickReply: { timestamp, deleted: true }
|
|
780
|
+
}, '');
|
|
781
|
+
};
|
|
904
782
|
/**
|
|
905
783
|
* queries need to be fired on connection open
|
|
906
784
|
* help ensure parity with WA Web
|
|
907
785
|
* */
|
|
908
786
|
const executeInitQueries = async () => {
|
|
909
|
-
await Promise.all([
|
|
910
|
-
|
|
911
|
-
fetchBlocklist(),
|
|
912
|
-
fetchPrivacySettings(),
|
|
913
|
-
])
|
|
914
|
-
}
|
|
915
|
-
|
|
787
|
+
await Promise.all([fetchProps(), fetchBlocklist(), fetchPrivacySettings()]);
|
|
788
|
+
};
|
|
916
789
|
const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
|
|
917
|
-
ev.emit('messages.upsert', { messages: [msg], type })
|
|
790
|
+
ev.emit('messages.upsert', { messages: [msg], type });
|
|
918
791
|
if (!!msg.pushName) {
|
|
919
|
-
let jid = msg.key.fromMe ? authState.creds.me.id :
|
|
920
|
-
jid =
|
|
921
|
-
|
|
792
|
+
let jid = msg.key.fromMe ? authState.creds.me.id : msg.key.participant || msg.key.remoteJid;
|
|
793
|
+
jid = jidNormalizedUser(jid);
|
|
922
794
|
if (!msg.key.fromMe) {
|
|
923
|
-
ev.emit('contacts.update', [{ id: jid, notify: msg.pushName, verifiedName: msg.verifiedBizName }])
|
|
795
|
+
ev.emit('contacts.update', [{ id: jid, notify: msg.pushName, verifiedName: msg.verifiedBizName }]);
|
|
924
796
|
}
|
|
925
|
-
|
|
926
797
|
// update our pushname too
|
|
927
798
|
if (msg.key.fromMe && msg.pushName && authState.creds.me?.name !== msg.pushName) {
|
|
928
|
-
ev.emit('creds.update', { me: { ...authState.creds.me, name: msg.pushName } })
|
|
799
|
+
ev.emit('creds.update', { me: { ...authState.creds.me, name: msg.pushName } });
|
|
929
800
|
}
|
|
930
801
|
}
|
|
931
|
-
|
|
932
|
-
const historyMsg = Utils_1.getHistoryMsg(msg.message)
|
|
802
|
+
const historyMsg = getHistoryMsg(msg.message);
|
|
933
803
|
const shouldProcessHistoryMsg = historyMsg
|
|
934
|
-
?
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
if (historyMsg && syncState === Types_1.SyncState.AwaitingInitialSync) {
|
|
804
|
+
? shouldSyncHistoryMessage(historyMsg) && PROCESSABLE_HISTORY_TYPES.includes(historyMsg.syncType)
|
|
805
|
+
: false;
|
|
806
|
+
// State machine: decide on sync and flush
|
|
807
|
+
if (historyMsg && syncState === SyncState.AwaitingInitialSync) {
|
|
939
808
|
if (awaitingSyncTimeout) {
|
|
940
|
-
|
|
941
|
-
|
|
809
|
+
clearTimeout(awaitingSyncTimeout);
|
|
810
|
+
awaitingSyncTimeout = undefined;
|
|
942
811
|
}
|
|
943
|
-
|
|
944
812
|
if (shouldProcessHistoryMsg) {
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
813
|
+
syncState = SyncState.Syncing;
|
|
814
|
+
logger.info('Transitioned to Syncing state');
|
|
815
|
+
// Let doAppStateSync handle the final flush after it's done
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
syncState = SyncState.Online;
|
|
819
|
+
logger.info('History sync skipped, transitioning to Online state and flushing buffer');
|
|
820
|
+
ev.flush();
|
|
952
821
|
}
|
|
953
822
|
}
|
|
954
|
-
|
|
955
823
|
const doAppStateSync = async () => {
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
}
|
|
968
|
-
}
|
|
969
|
-
|
|
824
|
+
if (syncState === SyncState.Syncing) {
|
|
825
|
+
logger.info('Doing app state sync');
|
|
826
|
+
await resyncAppState(ALL_WA_PATCH_NAMES, true);
|
|
827
|
+
// Sync is complete, go online and flush everything
|
|
828
|
+
syncState = SyncState.Online;
|
|
829
|
+
logger.info('App state sync complete, transitioning to Online state and flushing buffer');
|
|
830
|
+
ev.flush();
|
|
831
|
+
const accountSyncCounter = (authState.creds.accountSyncCounter || 0) + 1;
|
|
832
|
+
ev.emit('creds.update', { accountSyncCounter });
|
|
833
|
+
}
|
|
834
|
+
};
|
|
970
835
|
await Promise.all([
|
|
971
836
|
(async () => {
|
|
972
837
|
if (shouldProcessHistoryMsg) {
|
|
973
|
-
await doAppStateSync()
|
|
838
|
+
await doAppStateSync();
|
|
974
839
|
}
|
|
975
840
|
})(),
|
|
976
|
-
|
|
841
|
+
processMessage(msg, {
|
|
842
|
+
signalRepository,
|
|
977
843
|
shouldProcessHistoryMsg,
|
|
978
844
|
placeholderResendCache,
|
|
979
845
|
ev,
|
|
980
846
|
creds: authState.creds,
|
|
981
847
|
keyStore: authState.keys,
|
|
982
848
|
logger,
|
|
983
|
-
options: config.options
|
|
984
|
-
getMessage: config.getMessage,
|
|
849
|
+
options: config.options
|
|
985
850
|
})
|
|
986
|
-
])
|
|
987
|
-
|
|
988
|
-
if (msg.message?.protocolMessage?.appStateSyncKeyShare && syncState ===
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
}
|
|
992
|
-
})
|
|
993
|
-
|
|
994
|
-
ws.on('CB:
|
|
995
|
-
ws.on('CB:chatstate', handlePresenceUpdate)
|
|
851
|
+
]);
|
|
852
|
+
// If the app state key arrives and we are waiting to sync, trigger the sync now.
|
|
853
|
+
if (msg.message?.protocolMessage?.appStateSyncKeyShare && syncState === SyncState.Syncing) {
|
|
854
|
+
logger.info('App state sync key arrived, triggering app state sync');
|
|
855
|
+
await doAppStateSync();
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
ws.on('CB:presence', handlePresenceUpdate);
|
|
859
|
+
ws.on('CB:chatstate', handlePresenceUpdate);
|
|
996
860
|
ws.on('CB:ib,,dirty', async (node) => {
|
|
997
|
-
const { attrs } =
|
|
998
|
-
const type = attrs.type
|
|
999
|
-
|
|
861
|
+
const { attrs } = getBinaryNodeChild(node, 'dirty');
|
|
862
|
+
const type = attrs.type;
|
|
1000
863
|
switch (type) {
|
|
1001
864
|
case 'account_sync':
|
|
1002
865
|
if (attrs.timestamp) {
|
|
1003
|
-
let { lastAccountSyncTimestamp } = authState.creds
|
|
866
|
+
let { lastAccountSyncTimestamp } = authState.creds;
|
|
1004
867
|
if (lastAccountSyncTimestamp) {
|
|
1005
|
-
await cleanDirtyBits('account_sync', lastAccountSyncTimestamp)
|
|
868
|
+
await cleanDirtyBits('account_sync', lastAccountSyncTimestamp);
|
|
1006
869
|
}
|
|
1007
|
-
lastAccountSyncTimestamp = +attrs.timestamp
|
|
1008
|
-
ev.emit('creds.update', { lastAccountSyncTimestamp })
|
|
870
|
+
lastAccountSyncTimestamp = +attrs.timestamp;
|
|
871
|
+
ev.emit('creds.update', { lastAccountSyncTimestamp });
|
|
1009
872
|
}
|
|
1010
|
-
break
|
|
873
|
+
break;
|
|
1011
874
|
case 'groups':
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
break
|
|
875
|
+
// handled in groups.ts
|
|
876
|
+
break;
|
|
1015
877
|
default:
|
|
1016
|
-
logger.info({ node }, 'received unknown sync')
|
|
1017
|
-
break
|
|
878
|
+
logger.info({ node }, 'received unknown sync');
|
|
879
|
+
break;
|
|
1018
880
|
}
|
|
1019
|
-
})
|
|
1020
|
-
|
|
881
|
+
});
|
|
1021
882
|
ev.on('connection.update', ({ connection, receivedPendingNotifications }) => {
|
|
1022
883
|
if (connection === 'open') {
|
|
1023
884
|
if (fireInitQueries) {
|
|
1024
|
-
executeInitQueries()
|
|
1025
|
-
.catch(error => onUnexpectedError(error, 'init queries'))
|
|
885
|
+
executeInitQueries().catch(error => onUnexpectedError(error, 'init queries'));
|
|
1026
886
|
}
|
|
1027
|
-
sendPresenceUpdate(markOnlineOnConnect ? 'available' : 'unavailable')
|
|
1028
|
-
.catch(error => onUnexpectedError(error, 'presence update requests'))
|
|
887
|
+
sendPresenceUpdate(markOnlineOnConnect ? 'available' : 'unavailable').catch(error => onUnexpectedError(error, 'presence update requests'));
|
|
1029
888
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
return
|
|
889
|
+
if (!receivedPendingNotifications || syncState !== SyncState.Connecting) {
|
|
890
|
+
return;
|
|
1033
891
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
syncType: WAProto_1.proto.HistorySync.HistorySyncType.RECENT
|
|
1041
|
-
}))
|
|
1042
|
-
|
|
892
|
+
syncState = SyncState.AwaitingInitialSync;
|
|
893
|
+
logger.info('Connection is now AwaitingInitialSync, buffering events');
|
|
894
|
+
ev.buffer();
|
|
895
|
+
const willSyncHistory = shouldSyncHistoryMessage(proto.Message.HistorySyncNotification.create({
|
|
896
|
+
syncType: proto.HistorySync.HistorySyncType.RECENT
|
|
897
|
+
}));
|
|
1043
898
|
if (!willSyncHistory) {
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
899
|
+
logger.info('History sync is disabled by config, not waiting for notification. Transitioning to Online.');
|
|
900
|
+
syncState = SyncState.Online;
|
|
901
|
+
setTimeout(() => ev.flush(), 0);
|
|
902
|
+
return;
|
|
1048
903
|
}
|
|
1049
|
-
|
|
1050
|
-
logger.info('History sync is enabled, awaiting notification with a 20s timeout.')
|
|
1051
|
-
|
|
904
|
+
logger.info('History sync is enabled, awaiting notification with a 20s timeout.');
|
|
1052
905
|
if (awaitingSyncTimeout) {
|
|
1053
|
-
|
|
906
|
+
clearTimeout(awaitingSyncTimeout);
|
|
1054
907
|
}
|
|
1055
|
-
|
|
1056
908
|
awaitingSyncTimeout = setTimeout(() => {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
909
|
+
if (syncState === SyncState.AwaitingInitialSync) {
|
|
910
|
+
// TODO: investigate
|
|
911
|
+
logger.warn('Timeout in AwaitingInitialSync, forcing state to Online and flushing buffer');
|
|
912
|
+
syncState = SyncState.Online;
|
|
913
|
+
ev.flush();
|
|
914
|
+
}
|
|
915
|
+
}, 20000);
|
|
916
|
+
});
|
|
1065
917
|
return {
|
|
1066
|
-
...
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
removeContact,
|
|
918
|
+
...sock,
|
|
919
|
+
createCallLink,
|
|
920
|
+
getBotListV2,
|
|
1070
921
|
processingMutex,
|
|
1071
922
|
fetchPrivacySettings,
|
|
1072
923
|
upsertMessage,
|
|
1073
924
|
appPatch,
|
|
1074
|
-
createCallLink,
|
|
1075
925
|
sendPresenceUpdate,
|
|
1076
|
-
presenceSubscribe,
|
|
1077
|
-
|
|
1078
|
-
getLidUser,
|
|
1079
|
-
onWhatsApp,
|
|
926
|
+
presenceSubscribe,
|
|
927
|
+
profilePictureUrl,
|
|
1080
928
|
fetchBlocklist,
|
|
1081
929
|
fetchStatus,
|
|
1082
930
|
fetchDisappearingDuration,
|
|
@@ -1085,8 +933,9 @@ const makeChatsSocket = (config) => {
|
|
|
1085
933
|
updateProfileStatus,
|
|
1086
934
|
updateProfileName,
|
|
1087
935
|
updateBlockStatus,
|
|
936
|
+
updateDisableLinkPreviewsPrivacy,
|
|
1088
937
|
updateCallPrivacy,
|
|
1089
|
-
updateMessagesPrivacy,
|
|
938
|
+
updateMessagesPrivacy,
|
|
1090
939
|
updateLastSeenPrivacy,
|
|
1091
940
|
updateOnlinePrivacy,
|
|
1092
941
|
updateProfilePicturePrivacy,
|
|
@@ -1094,20 +943,20 @@ const makeChatsSocket = (config) => {
|
|
|
1094
943
|
updateReadReceiptsPrivacy,
|
|
1095
944
|
updateGroupsAddPrivacy,
|
|
1096
945
|
updateDefaultDisappearingMode,
|
|
1097
|
-
updateDisableLinkPreviewsPrivacy,
|
|
1098
946
|
getBusinessProfile,
|
|
1099
947
|
resyncAppState,
|
|
1100
948
|
chatModify,
|
|
1101
949
|
cleanDirtyBits,
|
|
950
|
+
addOrEditContact,
|
|
951
|
+
removeContact,
|
|
1102
952
|
addLabel,
|
|
1103
953
|
addChatLabel,
|
|
1104
954
|
removeChatLabel,
|
|
1105
955
|
addMessageLabel,
|
|
1106
956
|
removeMessageLabel,
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
}
|
|
957
|
+
star,
|
|
958
|
+
addOrEditQuickReply,
|
|
959
|
+
removeQuickReply
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
//# sourceMappingURL=chats.js.map
|