slidge-whatsapp 0.2.6__cp312-cp312-manylinux_2_36_aarch64.whl → 0.3.0__cp312-cp312-manylinux_2_36_aarch64.whl
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.
Potentially problematic release.
This version of slidge-whatsapp might be problematic. Click here for more details.
- slidge_whatsapp/contact.py +15 -3
- slidge_whatsapp/event.go +152 -50
- slidge_whatsapp/gateway.go +7 -63
- slidge_whatsapp/gateway.py +2 -3
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.h +185 -168
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +149 -135
- slidge_whatsapp/generated/whatsapp.c +1883 -1611
- slidge_whatsapp/generated/whatsapp.go +1157 -1046
- slidge_whatsapp/generated/whatsapp.py +1326 -1201
- slidge_whatsapp/generated/whatsapp_go.h +185 -168
- slidge_whatsapp/go.mod +18 -15
- slidge_whatsapp/go.sum +38 -32
- slidge_whatsapp/group.py +34 -30
- slidge_whatsapp/media/media.go +6 -2
- slidge_whatsapp/session.go +34 -17
- slidge_whatsapp/session.py +46 -14
- slidge_whatsapp/vendor/github.com/beeper/argo-go/LICENSE +9 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockreader.go +329 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockwriter.go +417 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/decoder.go +652 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/encoder.go +985 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/header/header.go +135 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/internal/util/util.go +133 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/label/label.go +384 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/label/wiremarkers.go +37 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/bitset/bitset.go +197 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/buf/buf.go +420 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/varint/varint.go +246 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/wire/wire.go +614 -0
- slidge_whatsapp/vendor/github.com/beeper/argo-go/wirecodec/decode.go +341 -0
- slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/LICENSE +21 -0
- slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/list.go +95 -0
- slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/orderedmap.go +187 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz.go +1 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_cgo.go +3 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_nocgo.go +4 -5
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_darwin.go +11 -1
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_linux.go +10 -0
- slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_windows.go +12 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/.gitignore +0 -2
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/CHANGELOG.md +30 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/COPYRIGHT.txt +6 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/README.md +14 -17
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi.go +1 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi2.go +7 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/LICENSE +21 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_amd64/libffi.8.dylib +0 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_arm64/libffi.8.dylib +0 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/windows_amd64/libffi-8.dll +0 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif.go +15 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif_arm64.go +16 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed.go +49 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_amd64.go +10 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_arm64.go +10 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_windows_amd64.go +10 -0
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/ffi.go +51 -13
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/init.go +22 -9
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/README.md +2 -0
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +3096 -1651
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +188 -128
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go +13 -140
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3ext.h +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.23.go +2 -2
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.25.go +37 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/LICENSE +19 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go +37 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/collections.go +148 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/comment.go +31 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/decode.go +216 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/definition.go +110 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +43 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/document.go +89 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go +159 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go +41 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/operation.go +32 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/path.go +72 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +41 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/source.go +19 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/type.go +68 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/value.go +122 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/handleerrors.go +60 -26
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/json.go +1 -6
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/networkerror.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +104 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +19 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/.pre-commit-config.yaml +3 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +5 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo-wire-type-store.argo +63 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo.go +62 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/name-to-queryids.json +306 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +40 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/binary/encoder.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +79 -45
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +13 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download-to-file.go +19 -12
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +26 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +99 -27
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +54 -26
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +208 -57
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +2 -14
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/newsletter.go +83 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +17 -8
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +15 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/extra.go +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +983 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.proto +85 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +197 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.proto +13 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +279 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.proto +21 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +137 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.proto +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +313 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.proto +27 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1299 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.proto +112 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +514 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.proto +47 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +123 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.proto +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +720 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.proto +59 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +365 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.proto +33 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1238 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.proto +105 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +16 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +5156 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.proto +516 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.pb.go +46 -10
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.proto +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8975 -11209
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +193 -421
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +52 -23
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +198 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/extra.go +7 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +952 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +88 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +1143 -463
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +60 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +60 -38
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +11 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +20 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingfields.json +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingtoken.go +176 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +10 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +38 -21
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +9 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +25 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +4 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/10-chat-db-lid-migration-ts.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +5 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +13 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +14 -8
- slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +44 -2
- slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +8 -8
- slidge_whatsapp/vendor/golang.org/x/net/http2/gotrack.go +14 -3
- slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +7 -29
- slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +53 -71
- slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +20 -74
- slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/mkerrors.sh +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_darwin.go +1 -55
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_solaris.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux.go +47 -16
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +3 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +4 -4
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux.go +168 -12
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +17 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +18 -2
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +17 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +17 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +18 -2
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +6 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +483 -483
- slidge_whatsapp/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +25 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +0 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +10 -5
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/presence.go +33 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +6 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +68 -22
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go +2 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go +8 -37
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/presence.go +0 -3
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +8 -0
- slidge_whatsapp/vendor/modules.txt +57 -23
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/METADATA +5 -4
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/RECORD +254 -174
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/WHEEL +1 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi_amd64.go +0 -7
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go124.go +0 -61
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_pre_go124.go +0 -16
- slidge_whatsapp/vendor/golang.org/x/net/http2/timer.go +0 -20
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/entry_points.txt +0 -0
- {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -21,6 +21,7 @@ import (
|
|
|
21
21
|
|
|
22
22
|
"github.com/gorilla/websocket"
|
|
23
23
|
"go.mau.fi/util/exhttp"
|
|
24
|
+
"go.mau.fi/util/exsync"
|
|
24
25
|
"go.mau.fi/util/random"
|
|
25
26
|
"golang.org/x/net/proxy"
|
|
26
27
|
|
|
@@ -39,12 +40,13 @@ import (
|
|
|
39
40
|
|
|
40
41
|
// EventHandler is a function that can handle events from WhatsApp.
|
|
41
42
|
type EventHandler func(evt any)
|
|
43
|
+
type EventHandlerWithSuccessStatus func(evt any) bool
|
|
42
44
|
type nodeHandler func(node *waBinary.Node)
|
|
43
45
|
|
|
44
46
|
var nextHandlerID uint32
|
|
45
47
|
|
|
46
48
|
type wrappedEventHandler struct {
|
|
47
|
-
fn
|
|
49
|
+
fn EventHandlerWithSuccessStatus
|
|
48
50
|
id uint32
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -66,7 +68,7 @@ type Client struct {
|
|
|
66
68
|
wsDialer *websocket.Dialer
|
|
67
69
|
|
|
68
70
|
isLoggedIn atomic.Bool
|
|
69
|
-
expectedDisconnect
|
|
71
|
+
expectedDisconnect *exsync.Event
|
|
70
72
|
EnableAutoReconnect bool
|
|
71
73
|
InitialAutoReconnect bool
|
|
72
74
|
LastSuccessfulConnect time.Time
|
|
@@ -96,6 +98,7 @@ type Client struct {
|
|
|
96
98
|
|
|
97
99
|
historySyncNotifications chan *waE2E.HistorySyncNotification
|
|
98
100
|
historySyncHandlerStarted atomic.Bool
|
|
101
|
+
ManualHistorySyncDownload bool
|
|
99
102
|
|
|
100
103
|
uploadPreKeysLock sync.Mutex
|
|
101
104
|
lastPreKeyUpload time.Time
|
|
@@ -159,6 +162,10 @@ type Client struct {
|
|
|
159
162
|
// Should SubscribePresence return an error if no privacy token is stored for the user?
|
|
160
163
|
ErrorOnSubscribePresenceWithoutToken bool
|
|
161
164
|
|
|
165
|
+
SendReportingTokens bool
|
|
166
|
+
|
|
167
|
+
BackgroundEventCtx context.Context
|
|
168
|
+
|
|
162
169
|
phoneLinkingCache *phoneLinkingCache
|
|
163
170
|
|
|
164
171
|
uniqueID string
|
|
@@ -175,7 +182,7 @@ type Client struct {
|
|
|
175
182
|
// separate library for all the non-e2ee-related stuff like logging in.
|
|
176
183
|
// The library is currently embedded in mautrix-meta (https://github.com/mautrix/meta), but may be separated later.
|
|
177
184
|
MessengerConfig *MessengerConfig
|
|
178
|
-
RefreshCAT func() error
|
|
185
|
+
RefreshCAT func(context.Context) error
|
|
179
186
|
}
|
|
180
187
|
|
|
181
188
|
type groupMetaCache struct {
|
|
@@ -219,18 +226,19 @@ func NewClient(deviceStore *store.Device, log waLog.Logger) *Client {
|
|
|
219
226
|
http: &http.Client{
|
|
220
227
|
Transport: (http.DefaultTransport.(*http.Transport)).Clone(),
|
|
221
228
|
},
|
|
222
|
-
proxy:
|
|
223
|
-
Store:
|
|
224
|
-
Log:
|
|
225
|
-
recvLog:
|
|
226
|
-
sendLog:
|
|
227
|
-
uniqueID:
|
|
228
|
-
responseWaiters:
|
|
229
|
-
eventHandlers:
|
|
230
|
-
messageRetries:
|
|
231
|
-
handlerQueue:
|
|
232
|
-
appStateProc:
|
|
233
|
-
socketWait:
|
|
229
|
+
proxy: http.ProxyFromEnvironment,
|
|
230
|
+
Store: deviceStore,
|
|
231
|
+
Log: log,
|
|
232
|
+
recvLog: log.Sub("Recv"),
|
|
233
|
+
sendLog: log.Sub("Send"),
|
|
234
|
+
uniqueID: fmt.Sprintf("%d.%d-", uniqueIDPrefix[0], uniqueIDPrefix[1]),
|
|
235
|
+
responseWaiters: make(map[string]chan<- *waBinary.Node),
|
|
236
|
+
eventHandlers: make([]wrappedEventHandler, 0, 1),
|
|
237
|
+
messageRetries: make(map[string]int),
|
|
238
|
+
handlerQueue: make(chan *waBinary.Node, handlerQueueSize),
|
|
239
|
+
appStateProc: appstate.NewProcessor(deviceStore, log.Sub("AppState")),
|
|
240
|
+
socketWait: make(chan struct{}),
|
|
241
|
+
expectedDisconnect: exsync.NewEvent(),
|
|
234
242
|
|
|
235
243
|
incomingRetryRequestCounter: make(map[incomingRetryKey]int),
|
|
236
244
|
|
|
@@ -248,6 +256,8 @@ func NewClient(deviceStore *store.Device, log waLog.Logger) *Client {
|
|
|
248
256
|
|
|
249
257
|
EnableAutoReconnect: true,
|
|
250
258
|
AutoTrustIdentity: true,
|
|
259
|
+
|
|
260
|
+
BackgroundEventCtx: context.Background(),
|
|
251
261
|
}
|
|
252
262
|
cli.nodeHandlers = map[string]nodeHandler{
|
|
253
263
|
"message": cli.handleEncryptedMessage,
|
|
@@ -411,6 +421,8 @@ func (cli *Client) WaitForConnection(timeout time.Duration) bool {
|
|
|
411
421
|
case <-ch:
|
|
412
422
|
case <-timeoutChan:
|
|
413
423
|
return false
|
|
424
|
+
case <-cli.expectedDisconnect.GetChan():
|
|
425
|
+
return false
|
|
414
426
|
}
|
|
415
427
|
cli.socketLock.RLock()
|
|
416
428
|
}
|
|
@@ -425,9 +437,16 @@ func (cli *Client) SetWSDialer(dialer *websocket.Dialer) {
|
|
|
425
437
|
// Connect connects the client to the WhatsApp web websocket. After connection, it will either
|
|
426
438
|
// authenticate if there's data in the device store, or emit a QREvent to set up a new link.
|
|
427
439
|
func (cli *Client) Connect() error {
|
|
428
|
-
|
|
440
|
+
if cli == nil {
|
|
441
|
+
return ErrClientIsNil
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
cli.socketLock.Lock()
|
|
445
|
+
defer cli.socketLock.Unlock()
|
|
446
|
+
|
|
447
|
+
err := cli.unlockedConnect()
|
|
429
448
|
if exhttp.IsNetworkError(err) && cli.InitialAutoReconnect && cli.EnableAutoReconnect {
|
|
430
|
-
cli.Log.Errorf("Initial connection failed but reconnecting in background")
|
|
449
|
+
cli.Log.Errorf("Initial connection failed but reconnecting in background (%v)", err)
|
|
431
450
|
go cli.dispatchEvent(&events.Disconnected{})
|
|
432
451
|
go cli.autoReconnect()
|
|
433
452
|
return nil
|
|
@@ -436,11 +455,13 @@ func (cli *Client) Connect() error {
|
|
|
436
455
|
}
|
|
437
456
|
|
|
438
457
|
func (cli *Client) connect() error {
|
|
439
|
-
if cli == nil {
|
|
440
|
-
return ErrClientIsNil
|
|
441
|
-
}
|
|
442
458
|
cli.socketLock.Lock()
|
|
443
459
|
defer cli.socketLock.Unlock()
|
|
460
|
+
|
|
461
|
+
return cli.unlockedConnect()
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
func (cli *Client) unlockedConnect() error {
|
|
444
465
|
if cli.socket != nil {
|
|
445
466
|
if !cli.socket.IsConnected() {
|
|
446
467
|
cli.unlockedDisconnect()
|
|
@@ -514,15 +535,15 @@ func (cli *Client) onDisconnect(ns *socket.NoiseSocket, remote bool) {
|
|
|
514
535
|
}
|
|
515
536
|
|
|
516
537
|
func (cli *Client) expectDisconnect() {
|
|
517
|
-
cli.expectedDisconnect.
|
|
538
|
+
cli.expectedDisconnect.Set()
|
|
518
539
|
}
|
|
519
540
|
|
|
520
541
|
func (cli *Client) resetExpectedDisconnect() {
|
|
521
|
-
cli.expectedDisconnect.
|
|
542
|
+
cli.expectedDisconnect.Clear()
|
|
522
543
|
}
|
|
523
544
|
|
|
524
545
|
func (cli *Client) isExpectedDisconnect() bool {
|
|
525
|
-
return cli.expectedDisconnect.
|
|
546
|
+
return cli.expectedDisconnect.IsSet()
|
|
526
547
|
}
|
|
527
548
|
|
|
528
549
|
func (cli *Client) autoReconnect() {
|
|
@@ -533,12 +554,17 @@ func (cli *Client) autoReconnect() {
|
|
|
533
554
|
autoReconnectDelay := time.Duration(cli.AutoReconnectErrors) * 2 * time.Second
|
|
534
555
|
cli.Log.Debugf("Automatically reconnecting after %v", autoReconnectDelay)
|
|
535
556
|
cli.AutoReconnectErrors++
|
|
536
|
-
|
|
557
|
+
if cli.expectedDisconnect.WaitTimeout(autoReconnectDelay) {
|
|
558
|
+
return
|
|
559
|
+
}
|
|
537
560
|
err := cli.connect()
|
|
538
561
|
if errors.Is(err, ErrAlreadyConnected) {
|
|
539
562
|
cli.Log.Debugf("Connect() said we're already connected after autoreconnect sleep")
|
|
540
563
|
return
|
|
541
564
|
} else if err != nil {
|
|
565
|
+
if cli.expectedDisconnect.IsSet() {
|
|
566
|
+
return
|
|
567
|
+
}
|
|
542
568
|
cli.Log.Errorf("Error reconnecting after autoreconnect sleep: %v", err)
|
|
543
569
|
if cli.AutoReconnectHook != nil && !cli.AutoReconnectHook(err) {
|
|
544
570
|
cli.Log.Debugf("AutoReconnectHook returned false, not reconnecting")
|
|
@@ -567,10 +593,11 @@ func (cli *Client) IsConnected() bool {
|
|
|
567
593
|
// This will not emit any events, the Disconnected event is only used when the
|
|
568
594
|
// connection is closed by the server or a network error.
|
|
569
595
|
func (cli *Client) Disconnect() {
|
|
570
|
-
if cli == nil
|
|
596
|
+
if cli == nil {
|
|
571
597
|
return
|
|
572
598
|
}
|
|
573
599
|
cli.socketLock.Lock()
|
|
600
|
+
cli.expectDisconnect()
|
|
574
601
|
cli.unlockedDisconnect()
|
|
575
602
|
cli.socketLock.Unlock()
|
|
576
603
|
cli.clearDelayedMessageRequests()
|
|
@@ -657,6 +684,13 @@ func (cli *Client) Logout(ctx context.Context) error {
|
|
|
657
684
|
// // Handle event and access mycli.WAClient
|
|
658
685
|
// }
|
|
659
686
|
func (cli *Client) AddEventHandler(handler EventHandler) uint32 {
|
|
687
|
+
return cli.AddEventHandlerWithSuccessStatus(func(evt any) bool {
|
|
688
|
+
handler(evt)
|
|
689
|
+
return true
|
|
690
|
+
})
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
func (cli *Client) AddEventHandlerWithSuccessStatus(handler EventHandlerWithSuccessStatus) uint32 {
|
|
660
694
|
nextID := atomic.AddUint32(&nextHandlerID, 1)
|
|
661
695
|
cli.eventHandlersLock.Lock()
|
|
662
696
|
cli.eventHandlers = append(cli.eventHandlers, wrappedEventHandler{handler, nextID})
|
|
@@ -738,25 +772,17 @@ func (cli *Client) handleFrame(data []byte) {
|
|
|
738
772
|
}
|
|
739
773
|
}
|
|
740
774
|
|
|
741
|
-
func stopAndDrainTimer(timer *time.Timer) {
|
|
742
|
-
if !timer.Stop() {
|
|
743
|
-
select {
|
|
744
|
-
case <-timer.C:
|
|
745
|
-
default:
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
775
|
func (cli *Client) handlerQueueLoop(ctx context.Context) {
|
|
751
|
-
|
|
752
|
-
|
|
776
|
+
ticker := time.NewTicker(30 * time.Second)
|
|
777
|
+
ticker.Stop()
|
|
753
778
|
cli.Log.Debugf("Starting handler queue loop")
|
|
779
|
+
Loop:
|
|
754
780
|
for {
|
|
755
781
|
select {
|
|
756
782
|
case node := <-cli.handlerQueue:
|
|
757
783
|
doneChan := make(chan struct{}, 1)
|
|
784
|
+
start := time.Now()
|
|
758
785
|
go func() {
|
|
759
|
-
start := time.Now()
|
|
760
786
|
cli.nodeHandlers[node.Tag](node)
|
|
761
787
|
duration := time.Since(start)
|
|
762
788
|
doneChan <- struct{}{}
|
|
@@ -764,13 +790,18 @@ func (cli *Client) handlerQueueLoop(ctx context.Context) {
|
|
|
764
790
|
cli.Log.Warnf("Node handling took %s for %s", duration, node.XMLString())
|
|
765
791
|
}
|
|
766
792
|
}()
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
793
|
+
ticker.Reset(30 * time.Second)
|
|
794
|
+
for i := 0; i < 10; i++ {
|
|
795
|
+
select {
|
|
796
|
+
case <-doneChan:
|
|
797
|
+
ticker.Stop()
|
|
798
|
+
continue Loop
|
|
799
|
+
case <-ticker.C:
|
|
800
|
+
cli.Log.Warnf("Node handling is taking long for %s (started %s ago)", node.XMLString(), time.Since(start))
|
|
801
|
+
}
|
|
773
802
|
}
|
|
803
|
+
cli.Log.Warnf("Continuing handling of %s in background as it's taking too long", node.XMLString())
|
|
804
|
+
ticker.Stop()
|
|
774
805
|
case <-ctx.Done():
|
|
775
806
|
cli.Log.Debugf("Closing handler queue loop")
|
|
776
807
|
return
|
|
@@ -803,7 +834,7 @@ func (cli *Client) sendNode(node waBinary.Node) error {
|
|
|
803
834
|
return err
|
|
804
835
|
}
|
|
805
836
|
|
|
806
|
-
func (cli *Client) dispatchEvent(evt any) {
|
|
837
|
+
func (cli *Client) dispatchEvent(evt any) (handlerFailed bool) {
|
|
807
838
|
cli.eventHandlersLock.RLock()
|
|
808
839
|
defer func() {
|
|
809
840
|
cli.eventHandlersLock.RUnlock()
|
|
@@ -813,8 +844,11 @@ func (cli *Client) dispatchEvent(evt any) {
|
|
|
813
844
|
}
|
|
814
845
|
}()
|
|
815
846
|
for _, handler := range cli.eventHandlers {
|
|
816
|
-
handler.fn(evt)
|
|
847
|
+
if !handler.fn(evt) {
|
|
848
|
+
return true
|
|
849
|
+
}
|
|
817
850
|
}
|
|
851
|
+
return false
|
|
818
852
|
}
|
|
819
853
|
|
|
820
854
|
// ParseWebMessage parses a WebMessageInfo object into *events.Message to match what real-time messages have.
|
|
@@ -17,7 +17,7 @@ import (
|
|
|
17
17
|
)
|
|
18
18
|
|
|
19
19
|
func (cli *Client) handleStreamError(node *waBinary.Node) {
|
|
20
|
-
ctx :=
|
|
20
|
+
ctx := cli.BackgroundEventCtx
|
|
21
21
|
cli.isLoggedIn.Store(false)
|
|
22
22
|
cli.clearResponseWaiters(node)
|
|
23
23
|
code, _ := node.Attrs["code"].(string)
|
|
@@ -58,7 +58,7 @@ func (cli *Client) handleStreamError(node *waBinary.Node) {
|
|
|
58
58
|
cli.Log.Infof("Got %s stream error, refreshing CAT before reconnecting...", code)
|
|
59
59
|
cli.socketLock.RLock()
|
|
60
60
|
defer cli.socketLock.RUnlock()
|
|
61
|
-
err := cli.RefreshCAT()
|
|
61
|
+
err := cli.RefreshCAT(ctx)
|
|
62
62
|
if err != nil {
|
|
63
63
|
cli.Log.Errorf("Failed to refresh CAT: %v", err)
|
|
64
64
|
cli.expectDisconnect()
|
|
@@ -94,7 +94,7 @@ func (cli *Client) handleIB(node *waBinary.Node) {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
func (cli *Client) handleConnectFailure(node *waBinary.Node) {
|
|
97
|
-
ctx :=
|
|
97
|
+
ctx := cli.BackgroundEventCtx
|
|
98
98
|
ag := node.AttrGetter()
|
|
99
99
|
reason := events.ConnectFailureReason(ag.Int("reason"))
|
|
100
100
|
message := ag.OptionalString("message")
|
|
@@ -136,7 +136,7 @@ func (cli *Client) handleConnectFailure(node *waBinary.Node) {
|
|
|
136
136
|
go cli.dispatchEvent(&events.ClientOutdated{})
|
|
137
137
|
} else if reason == events.ConnectFailureCATInvalid || reason == events.ConnectFailureCATExpired {
|
|
138
138
|
cli.Log.Infof("Got %d/%s connect failure, refreshing CAT before reconnecting...", int(reason), message)
|
|
139
|
-
err := cli.RefreshCAT()
|
|
139
|
+
err := cli.RefreshCAT(ctx)
|
|
140
140
|
if err != nil {
|
|
141
141
|
cli.Log.Errorf("Failed to refresh CAT: %v", err)
|
|
142
142
|
cli.expectDisconnect()
|
|
@@ -151,12 +151,17 @@ func (cli *Client) handleConnectFailure(node *waBinary.Node) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
func (cli *Client) handleConnectSuccess(node *waBinary.Node) {
|
|
154
|
-
ctx :=
|
|
154
|
+
ctx := cli.BackgroundEventCtx
|
|
155
155
|
cli.Log.Infof("Successfully authenticated")
|
|
156
156
|
cli.LastSuccessfulConnect = time.Now()
|
|
157
157
|
cli.AutoReconnectErrors = 0
|
|
158
158
|
cli.isLoggedIn.Store(true)
|
|
159
159
|
nodeLID := node.AttrGetter().JID("lid")
|
|
160
|
+
if !cli.Store.LID.IsEmpty() && !nodeLID.IsEmpty() && cli.Store.LID != nodeLID {
|
|
161
|
+
// This should probably never happen, but check just in case.
|
|
162
|
+
cli.Log.Warnf("Stored LID doesn't match one in connect success: %s != %s", cli.Store.LID, nodeLID)
|
|
163
|
+
cli.Store.LID = types.EmptyJID
|
|
164
|
+
}
|
|
160
165
|
if cli.Store.LID.IsEmpty() && !nodeLID.IsEmpty() {
|
|
161
166
|
cli.Store.LID = nodeLID
|
|
162
167
|
err := cli.Store.Save(ctx)
|
|
@@ -165,8 +170,10 @@ func (cli *Client) handleConnectSuccess(node *waBinary.Node) {
|
|
|
165
170
|
} else {
|
|
166
171
|
cli.Log.Infof("Updated LID to %s", cli.Store.LID)
|
|
167
172
|
}
|
|
168
|
-
cli.StoreLIDPNMapping(ctx, cli.Store.GetLID(), cli.Store.GetJID())
|
|
169
173
|
}
|
|
174
|
+
// Some users are missing their own LID-PN mapping even though it's already in the device table,
|
|
175
|
+
// so do this unconditionally for a few months to ensure everyone gets the row.
|
|
176
|
+
cli.StoreLIDPNMapping(ctx, cli.Store.GetLID(), cli.Store.GetJID())
|
|
170
177
|
go func() {
|
|
171
178
|
if dbCount, err := cli.Store.PreKeys.UploadedPreKeyCount(ctx); err != nil {
|
|
172
179
|
cli.Log.Errorf("Failed to get number of prekeys in database: %v", err)
|
|
@@ -94,8 +94,13 @@ func (cli *Client) DownloadMediaWithPathToFile(
|
|
|
94
94
|
// TODO omit hash for unencrypted media?
|
|
95
95
|
mediaURL := fmt.Sprintf("https://%s%s&hash=%s&mms-type=%s&__wa-mms=", host.Hostname, directPath, base64.URLEncoding.EncodeToString(encFileHash), mmsType)
|
|
96
96
|
err = cli.downloadAndDecryptToFile(ctx, mediaURL, mediaKey, mediaType, fileLength, encFileHash, fileHash, file)
|
|
97
|
-
if err == nil ||
|
|
98
|
-
errors.Is(err,
|
|
97
|
+
if err == nil ||
|
|
98
|
+
errors.Is(err, ErrFileLengthMismatch) ||
|
|
99
|
+
errors.Is(err, ErrInvalidMediaSHA256) ||
|
|
100
|
+
errors.Is(err, ErrMediaDownloadFailedWith403) ||
|
|
101
|
+
errors.Is(err, ErrMediaDownloadFailedWith404) ||
|
|
102
|
+
errors.Is(err, ErrMediaDownloadFailedWith410) ||
|
|
103
|
+
errors.Is(err, context.Canceled) {
|
|
99
104
|
return err
|
|
100
105
|
} else if i >= len(mediaConn.Hosts)-1 {
|
|
101
106
|
return fmt.Errorf("failed to download media from last host: %w", err)
|
|
@@ -127,16 +132,18 @@ func (cli *Client) downloadAndDecryptToFile(
|
|
|
127
132
|
return fmt.Errorf("failed to seek to start of file after validating mac: %w", err)
|
|
128
133
|
} else if err = cbcutil.DecryptFile(cipherKey, iv, file); err != nil {
|
|
129
134
|
return fmt.Errorf("failed to decrypt file: %w", err)
|
|
130
|
-
} else if
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
} else if ReturnDownloadWarnings {
|
|
136
|
+
if info, err := file.Stat(); err != nil {
|
|
137
|
+
return fmt.Errorf("failed to stat file: %w", err)
|
|
138
|
+
} else if fileLength >= 0 && info.Size() != int64(fileLength) {
|
|
139
|
+
return fmt.Errorf("%w: expected %d, got %d", ErrFileLengthMismatch, fileLength, info.Size())
|
|
140
|
+
} else if _, err = file.Seek(0, io.SeekStart); err != nil {
|
|
141
|
+
return fmt.Errorf("failed to seek to start of file after decrypting: %w", err)
|
|
142
|
+
} else if _, err = io.Copy(hasher, file); err != nil {
|
|
143
|
+
return fmt.Errorf("failed to hash file: %w", err)
|
|
144
|
+
} else if !hmac.Equal(fileSHA256, hasher.Sum(nil)) {
|
|
145
|
+
return ErrInvalidMediaSHA256
|
|
146
|
+
}
|
|
140
147
|
}
|
|
141
148
|
return nil
|
|
142
149
|
}
|
|
@@ -45,6 +45,7 @@ const (
|
|
|
45
45
|
MediaHistory MediaType = "WhatsApp History Keys"
|
|
46
46
|
MediaAppState MediaType = "WhatsApp App State Keys"
|
|
47
47
|
|
|
48
|
+
MediaStickerPack MediaType = "WhatsApp Sticker Pack Keys"
|
|
48
49
|
MediaLinkThumbnail MediaType = "WhatsApp Link Thumbnail Keys"
|
|
49
50
|
)
|
|
50
51
|
|
|
@@ -81,6 +82,7 @@ var (
|
|
|
81
82
|
_ DownloadableMessage = (*waE2E.VideoMessage)(nil)
|
|
82
83
|
_ DownloadableMessage = (*waE2E.DocumentMessage)(nil)
|
|
83
84
|
_ DownloadableMessage = (*waE2E.StickerMessage)(nil)
|
|
85
|
+
_ DownloadableMessage = (*waE2E.StickerPackMessage)(nil)
|
|
84
86
|
_ DownloadableMessage = (*waHistorySync.StickerMetadata)(nil)
|
|
85
87
|
_ DownloadableMessage = (*waE2E.HistorySyncNotification)(nil)
|
|
86
88
|
_ DownloadableMessage = (*waServerSync.ExternalBlobReference)(nil)
|
|
@@ -110,6 +112,7 @@ var classToMediaType = map[protoreflect.Name]MediaType{
|
|
|
110
112
|
"StickerMessage": MediaImage,
|
|
111
113
|
"StickerMetadata": MediaImage,
|
|
112
114
|
|
|
115
|
+
"StickerPackMessage": MediaStickerPack,
|
|
113
116
|
"HistorySyncNotification": MediaHistory,
|
|
114
117
|
"ExternalBlobReference": MediaAppState,
|
|
115
118
|
}
|
|
@@ -126,10 +129,13 @@ var mediaTypeToMMSType = map[MediaType]string{
|
|
|
126
129
|
MediaHistory: "md-msg-hist",
|
|
127
130
|
MediaAppState: "md-app-state",
|
|
128
131
|
|
|
132
|
+
MediaStickerPack: "sticker-pack",
|
|
129
133
|
MediaLinkThumbnail: "thumbnail-link",
|
|
130
134
|
}
|
|
131
135
|
|
|
132
136
|
// DownloadAny loops through the downloadable parts of the given message and downloads the first non-nil item.
|
|
137
|
+
//
|
|
138
|
+
// Deprecated: it's recommended to find the specific message type you want to download manually and use the Download method instead.
|
|
133
139
|
func (cli *Client) DownloadAny(ctx context.Context, msg *waE2E.Message) (data []byte, err error) {
|
|
134
140
|
if msg == nil {
|
|
135
141
|
return nil, ErrNothingDownloadableFound
|
|
@@ -161,6 +167,10 @@ func getSize(msg DownloadableMessage) int {
|
|
|
161
167
|
}
|
|
162
168
|
}
|
|
163
169
|
|
|
170
|
+
// ReturnDownloadWarnings controls whether the Download function returns non-fatal validation warnings.
|
|
171
|
+
// Currently, these include [ErrFileLengthMismatch] and [ErrInvalidMediaSHA256].
|
|
172
|
+
var ReturnDownloadWarnings = true
|
|
173
|
+
|
|
164
174
|
// DownloadThumbnail downloads a thumbnail from a message.
|
|
165
175
|
//
|
|
166
176
|
// This is primarily intended for downloading link preview thumbnails, which are in ExtendedTextMessage:
|
|
@@ -257,8 +267,13 @@ func (cli *Client) DownloadMediaWithPath(
|
|
|
257
267
|
// TODO omit hash for unencrypted media?
|
|
258
268
|
mediaURL := fmt.Sprintf("https://%s%s&hash=%s&mms-type=%s&__wa-mms=", host.Hostname, directPath, base64.URLEncoding.EncodeToString(encFileHash), mmsType)
|
|
259
269
|
data, err = cli.downloadAndDecrypt(ctx, mediaURL, mediaKey, mediaType, fileLength, encFileHash, fileHash)
|
|
260
|
-
if err == nil ||
|
|
261
|
-
errors.Is(err,
|
|
270
|
+
if err == nil ||
|
|
271
|
+
errors.Is(err, ErrFileLengthMismatch) ||
|
|
272
|
+
errors.Is(err, ErrInvalidMediaSHA256) ||
|
|
273
|
+
errors.Is(err, ErrMediaDownloadFailedWith403) ||
|
|
274
|
+
errors.Is(err, ErrMediaDownloadFailedWith404) ||
|
|
275
|
+
errors.Is(err, ErrMediaDownloadFailedWith410) ||
|
|
276
|
+
errors.Is(err, context.Canceled) {
|
|
262
277
|
return
|
|
263
278
|
} else if i >= len(mediaConn.Hosts)-1 {
|
|
264
279
|
return nil, fmt.Errorf("failed to download media from last host: %w", err)
|
|
@@ -288,10 +303,12 @@ func (cli *Client) downloadAndDecrypt(
|
|
|
288
303
|
|
|
289
304
|
} else if data, err = cbcutil.Decrypt(cipherKey, iv, ciphertext); err != nil {
|
|
290
305
|
err = fmt.Errorf("failed to decrypt file: %w", err)
|
|
291
|
-
} else if
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
306
|
+
} else if ReturnDownloadWarnings {
|
|
307
|
+
if fileLength >= 0 && len(data) != fileLength {
|
|
308
|
+
err = fmt.Errorf("%w: expected %d, got %d", ErrFileLengthMismatch, fileLength, len(data))
|
|
309
|
+
} else if len(fileSHA256) == 32 && sha256.Sum256(data) != *(*[32]byte)(fileSHA256) {
|
|
310
|
+
err = ErrInvalidMediaSHA256
|
|
311
|
+
}
|
|
295
312
|
}
|
|
296
313
|
return
|
|
297
314
|
}
|
|
@@ -302,6 +319,9 @@ func getMediaKeys(mediaKey []byte, appInfo MediaType) (iv, cipherKey, macKey, re
|
|
|
302
319
|
}
|
|
303
320
|
|
|
304
321
|
func shouldRetryMediaDownload(err error) bool {
|
|
322
|
+
if errors.Is(err, context.Canceled) {
|
|
323
|
+
return false
|
|
324
|
+
}
|
|
305
325
|
var netErr net.Error
|
|
306
326
|
var httpErr DownloadHTTPError
|
|
307
327
|
return errors.As(err, &netErr) ||
|
|
@@ -25,6 +25,9 @@ var (
|
|
|
25
25
|
|
|
26
26
|
ErrAlreadyConnected = errors.New("websocket is already connected")
|
|
27
27
|
|
|
28
|
+
ErrPhoneNumberTooShort = errors.New("phone number too short")
|
|
29
|
+
ErrPhoneNumberIsNotInternational = errors.New("international phone number required (must not start with 0)")
|
|
30
|
+
|
|
28
31
|
ErrQRAlreadyConnected = errors.New("GetQRChannel must be called before connecting")
|
|
29
32
|
ErrQRStoreContainsID = errors.New("GetQRChannel can only be called when there's no user ID in the client's Store")
|
|
30
33
|
|