slidge-whatsapp 0.2.7__cp313-cp313-manylinux_2_36_aarch64.whl → 0.3.0b0__cp313-cp313-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 +13 -3
- slidge_whatsapp/event.go +107 -37
- slidge_whatsapp/gateway.go +7 -63
- slidge_whatsapp/gateway.py +2 -3
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.h +218 -201
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +164 -150
- slidge_whatsapp/generated/whatsapp.c +1750 -1478
- slidge_whatsapp/generated/whatsapp.go +1307 -1196
- slidge_whatsapp/generated/whatsapp.py +1371 -1246
- slidge_whatsapp/generated/whatsapp_go.h +218 -201
- slidge_whatsapp/go.mod +18 -15
- slidge_whatsapp/go.sum +38 -26
- slidge_whatsapp/group.py +34 -30
- slidge_whatsapp/media/media.go +1 -1
- slidge_whatsapp/session.go +33 -16
- 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/networkerror.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +28 -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 +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +15 -18
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +5 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +97 -25
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +22 -10
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +10 -9
- 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 +5 -1
- 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/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 +30 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.proto +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8532 -11526
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +132 -438
- 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/waStatusAttributions/WAStatusAttributions.pb.go +225 -73
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +21 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +884 -441
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +40 -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/receipt.go +8 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +6 -4
- 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/store.go +25 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +3 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +12 -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/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 +43 -23
- {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/METADATA +2 -2
- {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/RECORD +208 -161
- 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.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/LICENSE +0 -0
- {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/WHEEL +0 -0
- {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/entry_points.txt +0 -0
|
@@ -39,6 +39,11 @@ type ReqCreateGroup struct {
|
|
|
39
39
|
// A create key can be provided to deduplicate the group create notification that will be triggered
|
|
40
40
|
// when the group is created. If provided, the JoinedGroup event will contain the same key.
|
|
41
41
|
CreateKey types.MessageID
|
|
42
|
+
|
|
43
|
+
types.GroupEphemeral
|
|
44
|
+
types.GroupAnnounce
|
|
45
|
+
types.GroupLocked
|
|
46
|
+
types.GroupMembershipApprovalMode
|
|
42
47
|
// Set IsParent to true to create a community instead of a normal group.
|
|
43
48
|
// When creating a community, the linked announcement group will be created automatically by the server.
|
|
44
49
|
types.GroupParent
|
|
@@ -49,13 +54,22 @@ type ReqCreateGroup struct {
|
|
|
49
54
|
// CreateGroup creates a group on WhatsApp with the given name and participants.
|
|
50
55
|
//
|
|
51
56
|
// See ReqCreateGroup for parameters.
|
|
52
|
-
func (cli *Client) CreateGroup(req ReqCreateGroup) (*types.GroupInfo, error) {
|
|
57
|
+
func (cli *Client) CreateGroup(ctx context.Context, req ReqCreateGroup) (*types.GroupInfo, error) {
|
|
53
58
|
participantNodes := make([]waBinary.Node, len(req.Participants), len(req.Participants)+1)
|
|
54
59
|
for i, participant := range req.Participants {
|
|
55
60
|
participantNodes[i] = waBinary.Node{
|
|
56
61
|
Tag: "participant",
|
|
57
62
|
Attrs: waBinary.Attrs{"jid": participant},
|
|
58
63
|
}
|
|
64
|
+
pt, err := cli.Store.PrivacyTokens.GetPrivacyToken(ctx, participant)
|
|
65
|
+
if err != nil {
|
|
66
|
+
return nil, fmt.Errorf("failed to get privacy token for participant %s: %v", participant, err)
|
|
67
|
+
} else if pt != nil {
|
|
68
|
+
participantNodes[i].Content = []waBinary.Node{{
|
|
69
|
+
Tag: "privacy",
|
|
70
|
+
Content: pt.Token,
|
|
71
|
+
}}
|
|
72
|
+
}
|
|
59
73
|
}
|
|
60
74
|
if req.CreateKey == "" {
|
|
61
75
|
req.CreateKey = cli.GenerateMessageID()
|
|
@@ -76,9 +90,33 @@ func (cli *Client) CreateGroup(req ReqCreateGroup) (*types.GroupInfo, error) {
|
|
|
76
90
|
Attrs: waBinary.Attrs{"jid": req.LinkedParentJID},
|
|
77
91
|
})
|
|
78
92
|
}
|
|
93
|
+
if req.IsLocked {
|
|
94
|
+
participantNodes = append(participantNodes, waBinary.Node{Tag: "locked"})
|
|
95
|
+
}
|
|
96
|
+
if req.IsAnnounce {
|
|
97
|
+
participantNodes = append(participantNodes, waBinary.Node{Tag: "announcement"})
|
|
98
|
+
}
|
|
99
|
+
if req.IsEphemeral {
|
|
100
|
+
participantNodes = append(participantNodes, waBinary.Node{
|
|
101
|
+
Tag: "ephemeral",
|
|
102
|
+
Attrs: waBinary.Attrs{
|
|
103
|
+
"expiration": req.DisappearingTimer,
|
|
104
|
+
"trigger": "1", // TODO what's this?
|
|
105
|
+
},
|
|
106
|
+
})
|
|
107
|
+
}
|
|
108
|
+
if req.IsJoinApprovalRequired {
|
|
109
|
+
participantNodes = append(participantNodes, waBinary.Node{
|
|
110
|
+
Tag: "membership_approval_mode",
|
|
111
|
+
Content: []waBinary.Node{{
|
|
112
|
+
Tag: "group_join",
|
|
113
|
+
Attrs: waBinary.Attrs{"state": "on"},
|
|
114
|
+
}},
|
|
115
|
+
})
|
|
116
|
+
}
|
|
79
117
|
// WhatsApp web doesn't seem to include the static prefix for these
|
|
80
118
|
key := strings.TrimPrefix(req.CreateKey, "3EB0")
|
|
81
|
-
resp, err := cli.sendGroupIQ(
|
|
119
|
+
resp, err := cli.sendGroupIQ(ctx, iqSet, types.GroupServerJID, waBinary.Node{
|
|
82
120
|
Tag: "create",
|
|
83
121
|
Attrs: waBinary.Attrs{
|
|
84
122
|
"subject": req.Name,
|
|
@@ -519,7 +557,14 @@ func (cli *Client) GetLinkedGroupsParticipants(community types.JID) ([]types.JID
|
|
|
519
557
|
if !ok {
|
|
520
558
|
return nil, &ElementMissingError{Tag: "linked_groups_participants", In: "response to community participants query"}
|
|
521
559
|
}
|
|
522
|
-
|
|
560
|
+
members, lidPairs := parseParticipantList(&participants)
|
|
561
|
+
if len(lidPairs) > 0 {
|
|
562
|
+
err = cli.Store.LIDs.PutManyLIDMappings(context.TODO(), lidPairs)
|
|
563
|
+
if err != nil {
|
|
564
|
+
cli.Log.Warnf("Failed to store LID mappings for community participants: %v", err)
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
return members, nil
|
|
523
568
|
}
|
|
524
569
|
|
|
525
570
|
// GetGroupInfo requests basic info about a group chat from the WhatsApp servers.
|
|
@@ -702,7 +747,7 @@ func parseGroupLinkTargetNode(groupNode *waBinary.Node) (types.GroupLinkTarget,
|
|
|
702
747
|
}, ag.Error()
|
|
703
748
|
}
|
|
704
749
|
|
|
705
|
-
func parseParticipantList(node *waBinary.Node) (participants []types.JID) {
|
|
750
|
+
func parseParticipantList(node *waBinary.Node) (participants []types.JID, lidPairs []store.LIDMapping) {
|
|
706
751
|
children := node.GetChildren()
|
|
707
752
|
participants = make([]types.JID, 0, len(children))
|
|
708
753
|
for _, child := range children {
|
|
@@ -711,14 +756,31 @@ func parseParticipantList(node *waBinary.Node) (participants []types.JID) {
|
|
|
711
756
|
continue
|
|
712
757
|
}
|
|
713
758
|
participants = append(participants, jid)
|
|
759
|
+
if jid.Server == types.HiddenUserServer {
|
|
760
|
+
phoneNumber, ok := child.Attrs["phone_number"].(types.JID)
|
|
761
|
+
if ok && !phoneNumber.IsEmpty() {
|
|
762
|
+
lidPairs = append(lidPairs, store.LIDMapping{
|
|
763
|
+
LID: jid,
|
|
764
|
+
PN: phoneNumber,
|
|
765
|
+
})
|
|
766
|
+
}
|
|
767
|
+
} else if jid.Server == types.DefaultUserServer {
|
|
768
|
+
lid, ok := child.Attrs["lid"].(types.JID)
|
|
769
|
+
if ok && !lid.IsEmpty() {
|
|
770
|
+
lidPairs = append(lidPairs, store.LIDMapping{
|
|
771
|
+
LID: lid,
|
|
772
|
+
PN: jid,
|
|
773
|
+
})
|
|
774
|
+
}
|
|
775
|
+
}
|
|
714
776
|
}
|
|
715
777
|
return
|
|
716
778
|
}
|
|
717
779
|
|
|
718
|
-
func (cli *Client) parseGroupCreate(parentNode, node *waBinary.Node) (*events.JoinedGroup, error) {
|
|
780
|
+
func (cli *Client) parseGroupCreate(parentNode, node *waBinary.Node) (*events.JoinedGroup, []store.LIDMapping, error) {
|
|
719
781
|
groupNode, ok := node.GetOptionalChildByTag("group")
|
|
720
782
|
if !ok {
|
|
721
|
-
return nil, fmt.Errorf("group create notification didn't contain group info")
|
|
783
|
+
return nil, nil, fmt.Errorf("group create notification didn't contain group info")
|
|
722
784
|
}
|
|
723
785
|
var evt events.JoinedGroup
|
|
724
786
|
pag := parentNode.AttrGetter()
|
|
@@ -731,13 +793,22 @@ func (cli *Client) parseGroupCreate(parentNode, node *waBinary.Node) (*events.Jo
|
|
|
731
793
|
evt.Notify = pag.OptionalString("notify")
|
|
732
794
|
info, err := cli.parseGroupNode(&groupNode)
|
|
733
795
|
if err != nil {
|
|
734
|
-
return nil, fmt.Errorf("failed to parse group info in create notification: %w", err)
|
|
796
|
+
return nil, nil, fmt.Errorf("failed to parse group info in create notification: %w", err)
|
|
735
797
|
}
|
|
736
798
|
evt.GroupInfo = *info
|
|
737
|
-
|
|
799
|
+
lidPairs := make([]store.LIDMapping, 0, len(info.Participants))
|
|
800
|
+
for _, pcp := range info.Participants {
|
|
801
|
+
if !pcp.PhoneNumber.IsEmpty() && !pcp.LID.IsEmpty() {
|
|
802
|
+
lidPairs = append(lidPairs, store.LIDMapping{
|
|
803
|
+
LID: pcp.LID,
|
|
804
|
+
PN: pcp.PhoneNumber,
|
|
805
|
+
})
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
return &evt, lidPairs, nil
|
|
738
809
|
}
|
|
739
810
|
|
|
740
|
-
func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, error) {
|
|
811
|
+
func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, []store.LIDMapping, error) {
|
|
741
812
|
var evt events.GroupInfo
|
|
742
813
|
ag := node.AttrGetter()
|
|
743
814
|
evt.JID = ag.JID("from")
|
|
@@ -746,9 +817,10 @@ func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, err
|
|
|
746
817
|
evt.SenderPN = ag.OptionalJID("participant_pn")
|
|
747
818
|
evt.Timestamp = ag.UnixTime("t")
|
|
748
819
|
if !ag.OK() {
|
|
749
|
-
return nil, fmt.Errorf("group change doesn't contain required attributes: %w", ag.Error())
|
|
820
|
+
return nil, nil, fmt.Errorf("group change doesn't contain required attributes: %w", ag.Error())
|
|
750
821
|
}
|
|
751
822
|
|
|
823
|
+
var lidPairs []store.LIDMapping
|
|
752
824
|
for _, child := range node.GetChildren() {
|
|
753
825
|
cag := child.AttrGetter()
|
|
754
826
|
if child.Tag == "add" || child.Tag == "remove" || child.Tag == "promote" || child.Tag == "demote" {
|
|
@@ -758,13 +830,13 @@ func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, err
|
|
|
758
830
|
switch child.Tag {
|
|
759
831
|
case "add":
|
|
760
832
|
evt.JoinReason = cag.OptionalString("reason")
|
|
761
|
-
evt.Join = parseParticipantList(&child)
|
|
833
|
+
evt.Join, lidPairs = parseParticipantList(&child)
|
|
762
834
|
case "remove":
|
|
763
|
-
evt.Leave = parseParticipantList(&child)
|
|
835
|
+
evt.Leave, lidPairs = parseParticipantList(&child)
|
|
764
836
|
case "promote":
|
|
765
|
-
evt.Promote = parseParticipantList(&child)
|
|
837
|
+
evt.Promote, lidPairs = parseParticipantList(&child)
|
|
766
838
|
case "demote":
|
|
767
|
-
evt.Demote = parseParticipantList(&child)
|
|
839
|
+
evt.Demote, lidPairs = parseParticipantList(&child)
|
|
768
840
|
case "locked":
|
|
769
841
|
evt.Locked = &types.GroupLocked{IsLocked: true}
|
|
770
842
|
case "unlocked":
|
|
@@ -785,7 +857,7 @@ func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, err
|
|
|
785
857
|
topicChild := child.GetChildByTag("body")
|
|
786
858
|
topicBytes, ok := topicChild.Content.([]byte)
|
|
787
859
|
if !ok {
|
|
788
|
-
return nil, fmt.Errorf("group change description has unexpected body: %s", topicChild.XMLString())
|
|
860
|
+
return nil, nil, fmt.Errorf("group change description has unexpected body: %s", topicChild.XMLString())
|
|
789
861
|
}
|
|
790
862
|
topicStr = string(topicBytes)
|
|
791
863
|
}
|
|
@@ -827,12 +899,12 @@ func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, err
|
|
|
827
899
|
}
|
|
828
900
|
groupNode, ok := child.GetOptionalChildByTag("group")
|
|
829
901
|
if !ok {
|
|
830
|
-
return nil, &ElementMissingError{Tag: "group", In: "group link"}
|
|
902
|
+
return nil, nil, &ElementMissingError{Tag: "group", In: "group link"}
|
|
831
903
|
}
|
|
832
904
|
var err error
|
|
833
905
|
evt.Link.Group, err = parseGroupLinkTargetNode(&groupNode)
|
|
834
906
|
if err != nil {
|
|
835
|
-
return nil, fmt.Errorf("failed to parse group link node in group change: %w", err)
|
|
907
|
+
return nil, nil, fmt.Errorf("failed to parse group link node in group change: %w", err)
|
|
836
908
|
}
|
|
837
909
|
case "unlink":
|
|
838
910
|
evt.Unlink = &types.GroupLinkChange{
|
|
@@ -841,12 +913,12 @@ func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, err
|
|
|
841
913
|
}
|
|
842
914
|
groupNode, ok := child.GetOptionalChildByTag("group")
|
|
843
915
|
if !ok {
|
|
844
|
-
return nil, &ElementMissingError{Tag: "group", In: "group unlink"}
|
|
916
|
+
return nil, nil, &ElementMissingError{Tag: "group", In: "group unlink"}
|
|
845
917
|
}
|
|
846
918
|
var err error
|
|
847
919
|
evt.Unlink.Group, err = parseGroupLinkTargetNode(&groupNode)
|
|
848
920
|
if err != nil {
|
|
849
|
-
return nil, fmt.Errorf("failed to parse group unlink node in group change: %w", err)
|
|
921
|
+
return nil, nil, fmt.Errorf("failed to parse group unlink node in group change: %w", err)
|
|
850
922
|
}
|
|
851
923
|
case "membership_approval_mode":
|
|
852
924
|
evt.MembershipApprovalMode = &types.GroupMembershipApprovalMode{
|
|
@@ -856,10 +928,10 @@ func (cli *Client) parseGroupChange(node *waBinary.Node) (*events.GroupInfo, err
|
|
|
856
928
|
evt.UnknownChanges = append(evt.UnknownChanges, &child)
|
|
857
929
|
}
|
|
858
930
|
if !cag.OK() {
|
|
859
|
-
return nil, fmt.Errorf("group change %s element doesn't contain required attributes: %w", child.Tag, cag.Error())
|
|
931
|
+
return nil, nil, fmt.Errorf("group change %s element doesn't contain required attributes: %w", child.Tag, cag.Error())
|
|
860
932
|
}
|
|
861
933
|
}
|
|
862
|
-
return &evt, nil
|
|
934
|
+
return &evt, lidPairs, nil
|
|
863
935
|
}
|
|
864
936
|
|
|
865
937
|
func (cli *Client) updateGroupParticipantCache(evt *events.GroupInfo) {
|
|
@@ -893,17 +965,17 @@ Outer:
|
|
|
893
965
|
}
|
|
894
966
|
}
|
|
895
967
|
|
|
896
|
-
func (cli *Client) parseGroupNotification(node *waBinary.Node) (any, error) {
|
|
968
|
+
func (cli *Client) parseGroupNotification(node *waBinary.Node) (any, []store.LIDMapping, error) {
|
|
897
969
|
children := node.GetChildren()
|
|
898
970
|
if len(children) == 1 && children[0].Tag == "create" {
|
|
899
971
|
return cli.parseGroupCreate(node, &children[0])
|
|
900
972
|
} else {
|
|
901
|
-
groupChange, err := cli.parseGroupChange(node)
|
|
973
|
+
groupChange, lidPairs, err := cli.parseGroupChange(node)
|
|
902
974
|
if err != nil {
|
|
903
|
-
return nil, err
|
|
975
|
+
return nil, nil, err
|
|
904
976
|
}
|
|
905
977
|
cli.updateGroupParticipantCache(groupChange)
|
|
906
|
-
return groupChange, nil
|
|
978
|
+
return groupChange, lidPairs, nil
|
|
907
979
|
}
|
|
908
980
|
}
|
|
909
981
|
|
|
@@ -219,11 +219,11 @@ func (int *DangerousInternalClient) ParseGroupNode(groupNode *waBinary.Node) (*t
|
|
|
219
219
|
return int.c.parseGroupNode(groupNode)
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
func (int *DangerousInternalClient) ParseGroupCreate(parentNode, node *waBinary.Node) (*events.JoinedGroup, error) {
|
|
222
|
+
func (int *DangerousInternalClient) ParseGroupCreate(parentNode, node *waBinary.Node) (*events.JoinedGroup, []store.LIDMapping, error) {
|
|
223
223
|
return int.c.parseGroupCreate(parentNode, node)
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
-
func (int *DangerousInternalClient) ParseGroupChange(node *waBinary.Node) (*events.GroupInfo, error) {
|
|
226
|
+
func (int *DangerousInternalClient) ParseGroupChange(node *waBinary.Node) (*events.GroupInfo, []store.LIDMapping, error) {
|
|
227
227
|
return int.c.parseGroupChange(node)
|
|
228
228
|
}
|
|
229
229
|
|
|
@@ -231,7 +231,7 @@ func (int *DangerousInternalClient) UpdateGroupParticipantCache(evt *events.Grou
|
|
|
231
231
|
int.c.updateGroupParticipantCache(evt)
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
func (int *DangerousInternalClient) ParseGroupNotification(node *waBinary.Node) (any, error) {
|
|
234
|
+
func (int *DangerousInternalClient) ParseGroupNotification(node *waBinary.Node) (any, []store.LIDMapping, error) {
|
|
235
235
|
return int.c.parseGroupNotification(node)
|
|
236
236
|
}
|
|
237
237
|
|
|
@@ -279,7 +279,7 @@ func (int *DangerousInternalClient) ParseMessageInfo(node *waBinary.Node) (*type
|
|
|
279
279
|
return int.c.parseMessageInfo(node)
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
func (int *DangerousInternalClient) HandlePlaintextMessage(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) bool {
|
|
282
|
+
func (int *DangerousInternalClient) HandlePlaintextMessage(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) (handlerFailed bool) {
|
|
283
283
|
return int.c.handlePlaintextMessage(ctx, info, node)
|
|
284
284
|
}
|
|
285
285
|
|
|
@@ -319,16 +319,16 @@ func (int *DangerousInternalClient) HandleAppStateSyncKeyShare(ctx context.Conte
|
|
|
319
319
|
int.c.handleAppStateSyncKeyShare(ctx, keys)
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
func (int *DangerousInternalClient) HandlePlaceholderResendResponse(msg *waE2E.PeerDataOperationRequestResponseMessage) {
|
|
323
|
-
int.c.handlePlaceholderResendResponse(msg)
|
|
322
|
+
func (int *DangerousInternalClient) HandlePlaceholderResendResponse(msg *waE2E.PeerDataOperationRequestResponseMessage) (ok bool) {
|
|
323
|
+
return int.c.handlePlaceholderResendResponse(msg)
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
func (int *DangerousInternalClient) HandleProtocolMessage(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) {
|
|
327
|
-
int.c.handleProtocolMessage(ctx, info, msg)
|
|
326
|
+
func (int *DangerousInternalClient) HandleProtocolMessage(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) (ok bool) {
|
|
327
|
+
return int.c.handleProtocolMessage(ctx, info, msg)
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
func (int *DangerousInternalClient) ProcessProtocolParts(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) {
|
|
331
|
-
int.c.processProtocolParts(ctx, info, msg)
|
|
330
|
+
func (int *DangerousInternalClient) ProcessProtocolParts(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) (ok bool) {
|
|
331
|
+
return int.c.processProtocolParts(ctx, info, msg)
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
func (int *DangerousInternalClient) StoreMessageSecret(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) {
|
|
@@ -339,6 +339,18 @@ func (int *DangerousInternalClient) StoreHistoricalMessageSecrets(ctx context.Co
|
|
|
339
339
|
int.c.storeHistoricalMessageSecrets(ctx, conversations)
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
+
func (int *DangerousInternalClient) StoreLIDSyncMessage(ctx context.Context, msg []byte) {
|
|
343
|
+
int.c.storeLIDSyncMessage(ctx, msg)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
func (int *DangerousInternalClient) StoreGlobalSettings(ctx context.Context, settings *waHistorySync.GlobalSettings) {
|
|
347
|
+
int.c.storeGlobalSettings(ctx, settings)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
func (int *DangerousInternalClient) StoreHistoricalPNLIDMappings(ctx context.Context, mappings []*waHistorySync.PhoneNumberToLIDMapping) {
|
|
351
|
+
int.c.storeHistoricalPNLIDMappings(ctx, mappings)
|
|
352
|
+
}
|
|
353
|
+
|
|
342
354
|
func (int *DangerousInternalClient) HandleDecryptedMessage(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message, retryCount int) bool {
|
|
343
355
|
return int.c.handleDecryptedMessage(ctx, info, msg, retryCount)
|
|
344
356
|
}
|
|
@@ -69,7 +69,7 @@ func (cli *Client) handleEncryptedMessage(node *waBinary.Node) {
|
|
|
69
69
|
|
|
70
70
|
func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bool) (source types.MessageSource, err error) {
|
|
71
71
|
clientID := cli.getOwnID()
|
|
72
|
-
clientLID := cli.
|
|
72
|
+
clientLID := cli.getOwnLID()
|
|
73
73
|
if clientID.IsEmpty() {
|
|
74
74
|
err = ErrNotLoggedIn
|
|
75
75
|
return
|
|
@@ -315,14 +315,12 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
315
315
|
decrypted, ciphertextHash, err = cli.decryptGroupMsg(ctx, &child, senderEncryptionJID, info.Chat, info.Timestamp)
|
|
316
316
|
} else if encType == "msmsg" && info.Sender.IsBot() {
|
|
317
317
|
targetSenderJID := info.MsgMetaInfo.TargetSender
|
|
318
|
-
messageSecretSenderJID := targetSenderJID
|
|
319
318
|
if targetSenderJID.User == "" {
|
|
320
319
|
if info.Sender.Server == types.BotServer {
|
|
321
|
-
targetSenderJID = cli.
|
|
320
|
+
targetSenderJID = cli.getOwnLID()
|
|
322
321
|
} else {
|
|
323
322
|
targetSenderJID = cli.getOwnID()
|
|
324
323
|
}
|
|
325
|
-
messageSecretSenderJID = cli.getOwnID()
|
|
326
324
|
}
|
|
327
325
|
var decryptMessageID string
|
|
328
326
|
if info.MsgBotInfo.EditType == types.EditTypeInner || info.MsgBotInfo.EditType == types.EditTypeLast {
|
|
@@ -332,7 +330,7 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
332
330
|
}
|
|
333
331
|
var msMsg waE2E.MessageSecretMessage
|
|
334
332
|
var messageSecret []byte
|
|
335
|
-
if messageSecret, err = cli.Store.MsgSecrets.GetMessageSecret(ctx, info.Chat,
|
|
333
|
+
if messageSecret, _, err = cli.Store.MsgSecrets.GetMessageSecret(ctx, info.Chat, targetSenderJID, info.MsgMetaInfo.TargetID); err != nil {
|
|
336
334
|
err = fmt.Errorf("failed to get message secret for %s: %v", info.MsgMetaInfo.TargetID, err)
|
|
337
335
|
} else if messageSecret == nil {
|
|
338
336
|
err = fmt.Errorf("message secret for %s not found", info.MsgMetaInfo.TargetID)
|
|
@@ -351,7 +349,7 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
351
349
|
return
|
|
352
350
|
} else if err != nil {
|
|
353
351
|
cli.Log.Warnf("Error decrypting message %s from %s: %v", info.ID, info.SourceString(), err)
|
|
354
|
-
if ctx.Err() != nil {
|
|
352
|
+
if ctx.Err() != nil || errors.Is(err, context.Canceled) {
|
|
355
353
|
handlerFailed = true
|
|
356
354
|
return
|
|
357
355
|
}
|
|
@@ -388,7 +386,10 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
388
386
|
default:
|
|
389
387
|
cli.Log.Warnf("Unknown version %d in decrypted message from %s", ag.Int("v"), info.SourceString())
|
|
390
388
|
}
|
|
391
|
-
if
|
|
389
|
+
if handlerFailed {
|
|
390
|
+
cli.Log.Warnf("Handler for %s failed", info.ID)
|
|
391
|
+
}
|
|
392
|
+
if ciphertextHash != nil && cli.EnableDecryptedEventBuffer && !handlerFailed {
|
|
392
393
|
// Use the context passed to decryptMessages
|
|
393
394
|
err = cli.Store.EventBuffer.ClearBufferedEventPlaintext(ctx, *ciphertextHash)
|
|
394
395
|
if err != nil {
|
|
@@ -412,7 +413,7 @@ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo,
|
|
|
412
413
|
}
|
|
413
414
|
}
|
|
414
415
|
}
|
|
415
|
-
if handled {
|
|
416
|
+
if handled && !handlerFailed {
|
|
416
417
|
go cli.sendMessageReceipt(info)
|
|
417
418
|
}
|
|
418
419
|
return
|
|
@@ -648,7 +649,7 @@ func (cli *Client) DownloadHistorySync(ctx context.Context, notif *waE2E.History
|
|
|
648
649
|
} else if err = proto.Unmarshal(rawData, &historySync); err != nil {
|
|
649
650
|
return nil, fmt.Errorf("failed to unmarshal: %w", err)
|
|
650
651
|
} else {
|
|
651
|
-
cli.Log.Debugf("Received history sync (type %s, chunk %d)", historySync.GetSyncType(), historySync.GetChunkOrder())
|
|
652
|
+
cli.Log.Debugf("Received history sync (type %s, chunk %d, progress %d)", historySync.GetSyncType(), historySync.GetChunkOrder(), historySync.GetProgress())
|
|
652
653
|
doStorage := func(ctx context.Context) {
|
|
653
654
|
if historySync.GetSyncType() == waHistorySync.HistorySync_PUSH_NAME {
|
|
654
655
|
cli.handleHistoricalPushNames(ctx, historySync.GetPushnames())
|
|
@@ -98,22 +98,10 @@ func (cli *Client) decryptMsgSecret(ctx context.Context, msg *events.Message, us
|
|
|
98
98
|
if err != nil {
|
|
99
99
|
return nil, err
|
|
100
100
|
}
|
|
101
|
-
baseEncKey, err := cli.Store.MsgSecrets.GetMessageSecret(ctx, msg.Info.Chat, origSender, origMsgKey.GetID())
|
|
101
|
+
baseEncKey, origSender, err := cli.Store.MsgSecrets.GetMessageSecret(ctx, msg.Info.Chat, origSender, origMsgKey.GetID())
|
|
102
102
|
if err != nil {
|
|
103
103
|
return nil, fmt.Errorf("failed to get original message secret key: %w", err)
|
|
104
104
|
}
|
|
105
|
-
if baseEncKey == nil && origMsgKey.GetFromMe() && origSender.Server == types.HiddenUserServer {
|
|
106
|
-
origSender, err = cli.Store.LIDs.GetPNForLID(ctx, origSender)
|
|
107
|
-
if err != nil {
|
|
108
|
-
return nil, fmt.Errorf("%w (also failed to get PN for LID: %w)", ErrOriginalMessageSecretNotFound, err)
|
|
109
|
-
} else if origSender.IsEmpty() {
|
|
110
|
-
return nil, fmt.Errorf("%w (PN for LID not found)", ErrOriginalMessageSecretNotFound)
|
|
111
|
-
}
|
|
112
|
-
baseEncKey, err = cli.Store.MsgSecrets.GetMessageSecret(ctx, msg.Info.Chat, origSender, origMsgKey.GetID())
|
|
113
|
-
if err != nil {
|
|
114
|
-
return nil, fmt.Errorf("failed to get original message secret key with PN: %w", err)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
105
|
if baseEncKey == nil {
|
|
118
106
|
return nil, ErrOriginalMessageSecretNotFound
|
|
119
107
|
}
|
|
@@ -132,7 +120,7 @@ func (cli *Client) encryptMsgSecret(ctx context.Context, ownID, chat, origSender
|
|
|
132
120
|
return nil, nil, ErrNotLoggedIn
|
|
133
121
|
}
|
|
134
122
|
|
|
135
|
-
baseEncKey, err := cli.Store.MsgSecrets.GetMessageSecret(ctx, chat, origSender, origMsgID)
|
|
123
|
+
baseEncKey, origSender, err := cli.Store.MsgSecrets.GetMessageSecret(ctx, chat, origSender, origMsgID)
|
|
136
124
|
if err != nil {
|
|
137
125
|
return nil, nil, fmt.Errorf("failed to get original message secret key: %w", err)
|
|
138
126
|
} else if baseEncKey == nil {
|
|
@@ -10,10 +10,16 @@ import (
|
|
|
10
10
|
"context"
|
|
11
11
|
"encoding/json"
|
|
12
12
|
"fmt"
|
|
13
|
+
"log"
|
|
13
14
|
"strings"
|
|
14
15
|
"time"
|
|
15
16
|
|
|
17
|
+
"github.com/beeper/argo-go/codec"
|
|
18
|
+
"github.com/beeper/argo-go/pkg/buf"
|
|
19
|
+
|
|
20
|
+
"go.mau.fi/whatsmeow/argo"
|
|
16
21
|
waBinary "go.mau.fi/whatsmeow/binary"
|
|
22
|
+
"go.mau.fi/whatsmeow/proto/waWa6"
|
|
17
23
|
"go.mau.fi/whatsmeow/types"
|
|
18
24
|
)
|
|
19
25
|
|
|
@@ -118,9 +124,53 @@ const (
|
|
|
118
124
|
mutationCreateNewsletter = "6234210096708695"
|
|
119
125
|
mutationUnfollowNewsletter = "6392786840836363"
|
|
120
126
|
mutationFollowNewsletter = "9926858900719341"
|
|
127
|
+
|
|
128
|
+
// desktop & mobile
|
|
129
|
+
queryFetchNewsletterDesktop = "9779843322044422"
|
|
130
|
+
queryRecommendedNewslettersDesktop = "27256776790637714"
|
|
131
|
+
querySubscribedNewslettersDesktop = "8621797084555037"
|
|
132
|
+
queryNewsletterSubscribersDesktop = "25403502652570342"
|
|
133
|
+
mutationMuteNewsletterDesktop = "5971669009605755" // variables -> {newsletter_id, updates->{description, settings}}, output: xwa2_newsletter_update -> NewsletterMetadata without viewer meta
|
|
134
|
+
mutationUnmuteNewsletterDesktop = "6104029483058502"
|
|
135
|
+
mutationUpdateNewsletterDesktop = "7839742399440946"
|
|
136
|
+
mutationCreateNewsletterDesktop = "27527996220149684"
|
|
137
|
+
mutationUnfollowNewsletterDesktop = "8782612271820087"
|
|
138
|
+
mutationFollowNewsletterDesktop = "8621797084555037"
|
|
121
139
|
)
|
|
122
140
|
|
|
141
|
+
func convertQueryID(cli *Client, queryID string) string {
|
|
142
|
+
if payload := cli.Store.GetClientPayload(); payload.GetUserAgent().Platform == waWa6.ClientPayload_UserAgent_MACOS.Enum() || payload.GetWebInfo() == nil {
|
|
143
|
+
switch queryID {
|
|
144
|
+
case queryFetchNewsletter:
|
|
145
|
+
return queryFetchNewsletterDesktop
|
|
146
|
+
case queryRecommendedNewsletters:
|
|
147
|
+
return queryRecommendedNewslettersDesktop
|
|
148
|
+
case querySubscribedNewsletters:
|
|
149
|
+
return querySubscribedNewslettersDesktop
|
|
150
|
+
case queryNewsletterSubscribers:
|
|
151
|
+
return queryNewsletterSubscribersDesktop
|
|
152
|
+
case mutationMuteNewsletter:
|
|
153
|
+
return mutationMuteNewsletterDesktop
|
|
154
|
+
case mutationUnmuteNewsletter:
|
|
155
|
+
return mutationUnmuteNewsletterDesktop
|
|
156
|
+
case mutationUpdateNewsletter:
|
|
157
|
+
return mutationUpdateNewsletterDesktop
|
|
158
|
+
case mutationCreateNewsletter:
|
|
159
|
+
return mutationCreateNewsletterDesktop
|
|
160
|
+
case mutationUnfollowNewsletter:
|
|
161
|
+
return mutationUnfollowNewsletterDesktop
|
|
162
|
+
case mutationFollowNewsletter:
|
|
163
|
+
return mutationFollowNewsletterDesktop
|
|
164
|
+
default:
|
|
165
|
+
return queryID
|
|
166
|
+
}
|
|
167
|
+
} else {
|
|
168
|
+
return queryID
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
123
172
|
func (cli *Client) sendMexIQ(ctx context.Context, queryID string, variables any) (json.RawMessage, error) {
|
|
173
|
+
queryID = convertQueryID(cli, queryID)
|
|
124
174
|
payload, err := json.Marshal(map[string]any{
|
|
125
175
|
"variables": variables,
|
|
126
176
|
})
|
|
@@ -151,14 +201,40 @@ func (cli *Client) sendMexIQ(ctx context.Context, queryID string, variables any)
|
|
|
151
201
|
if !ok {
|
|
152
202
|
return nil, fmt.Errorf("unexpected content type %T in mex response", result.Content)
|
|
153
203
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
204
|
+
if result.AttrGetter().OptionalString("format") == "argo" {
|
|
205
|
+
store, err := argo.GetStore()
|
|
206
|
+
if err != nil {
|
|
207
|
+
return nil, err
|
|
208
|
+
}
|
|
209
|
+
queryIDMap, err := argo.GetQueryIDToMessageName()
|
|
210
|
+
if err != nil {
|
|
211
|
+
return nil, err
|
|
212
|
+
}
|
|
213
|
+
wt := store[queryIDMap[queryID]]
|
|
214
|
+
|
|
215
|
+
decoder, err := codec.NewArgoDecoder(buf.NewBufReadonly(resultContent))
|
|
216
|
+
if err != nil {
|
|
217
|
+
return nil, err
|
|
218
|
+
}
|
|
219
|
+
data, err := decoder.ArgoToMap(wt)
|
|
220
|
+
if err != nil {
|
|
221
|
+
log.Fatalf("argo to map error: %v", err)
|
|
222
|
+
}
|
|
223
|
+
b, err := json.Marshal(data)
|
|
224
|
+
if err != nil {
|
|
225
|
+
return nil, err
|
|
226
|
+
}
|
|
227
|
+
return b, nil
|
|
228
|
+
} else {
|
|
229
|
+
var gqlResp types.GraphQLResponse
|
|
230
|
+
err = json.Unmarshal(resultContent, &gqlResp)
|
|
231
|
+
if err != nil {
|
|
232
|
+
return nil, fmt.Errorf("failed to unmarshal graphql response: %w", err)
|
|
233
|
+
} else if len(gqlResp.Errors) > 0 {
|
|
234
|
+
return gqlResp.Data, fmt.Errorf("graphql error: %w", gqlResp.Errors)
|
|
235
|
+
}
|
|
236
|
+
return gqlResp.Data, nil
|
|
160
237
|
}
|
|
161
|
-
return gqlResp.Data, nil
|
|
162
238
|
}
|
|
163
239
|
|
|
164
240
|
type respGetNewsletterInfo struct {
|
|
@@ -430,10 +430,14 @@ func (cli *Client) handleNotification(node *waBinary.Node) {
|
|
|
430
430
|
case "fbid:devices":
|
|
431
431
|
cli.handleFBDeviceNotification(ctx, node)
|
|
432
432
|
case "w:gp2":
|
|
433
|
-
evt, err := cli.parseGroupNotification(node)
|
|
433
|
+
evt, lidPairs, err := cli.parseGroupNotification(node)
|
|
434
434
|
if err != nil {
|
|
435
435
|
cli.Log.Errorf("Failed to parse group notification: %v", err)
|
|
436
436
|
} else {
|
|
437
|
+
err = cli.Store.LIDs.PutManyLIDMappings(ctx, lidPairs)
|
|
438
|
+
if err != nil {
|
|
439
|
+
cli.Log.Errorf("Failed to store LID mappings from group notification: %v", err)
|
|
440
|
+
}
|
|
437
441
|
cancelled = cli.dispatchEvent(evt)
|
|
438
442
|
}
|
|
439
443
|
case "picture":
|
|
@@ -94,9 +94,9 @@ func (cli *Client) PairPhone(ctx context.Context, phone string, showPushNotifica
|
|
|
94
94
|
ephemeralKeyPair, ephemeralKey, encodedLinkingCode := generateCompanionEphemeralKey()
|
|
95
95
|
phone = notNumbers.ReplaceAllString(phone, "")
|
|
96
96
|
if len(phone) <= 6 {
|
|
97
|
-
return "",
|
|
97
|
+
return "", ErrPhoneNumberTooShort
|
|
98
98
|
} else if strings.HasPrefix(phone, "0") {
|
|
99
|
-
return "",
|
|
99
|
+
return "", ErrPhoneNumberIsNotInternational
|
|
100
100
|
}
|
|
101
101
|
jid := types.NewJID(phone, types.DefaultUserServer)
|
|
102
102
|
resp, err := cli.sendIQ(infoQuery{
|
|
@@ -62,7 +62,9 @@ func (cli *Client) handlePresence(node *waBinary.Node) {
|
|
|
62
62
|
// You should call this at least once after connecting so that the server has your pushname.
|
|
63
63
|
// Otherwise, other users will see "-" as the name.
|
|
64
64
|
func (cli *Client) SendPresence(state types.Presence) error {
|
|
65
|
-
if
|
|
65
|
+
if cli == nil {
|
|
66
|
+
return ErrClientIsNil
|
|
67
|
+
} else if len(cli.Store.PushName) == 0 && cli.MessengerConfig == nil {
|
|
66
68
|
return ErrNoPushName
|
|
67
69
|
}
|
|
68
70
|
if state == types.PresenceAvailable {
|
|
@@ -70,12 +72,16 @@ func (cli *Client) SendPresence(state types.Presence) error {
|
|
|
70
72
|
} else {
|
|
71
73
|
cli.sendActiveReceipts.CompareAndSwap(1, 0)
|
|
72
74
|
}
|
|
75
|
+
attrs := waBinary.Attrs{
|
|
76
|
+
"type": string(state),
|
|
77
|
+
}
|
|
78
|
+
// PushName not set when using WhatsApp for Messenger E2EE
|
|
79
|
+
if cli.MessengerConfig == nil {
|
|
80
|
+
attrs["name"] = cli.Store.PushName
|
|
81
|
+
}
|
|
73
82
|
return cli.sendNode(waBinary.Node{
|
|
74
|
-
Tag:
|
|
75
|
-
Attrs:
|
|
76
|
-
"name": cli.Store.PushName,
|
|
77
|
-
"type": string(state),
|
|
78
|
-
},
|
|
83
|
+
Tag: "presence",
|
|
84
|
+
Attrs: attrs,
|
|
79
85
|
})
|
|
80
86
|
}
|
|
81
87
|
|
|
@@ -88,6 +94,9 @@ func (cli *Client) SendPresence(state types.Presence) error {
|
|
|
88
94
|
//
|
|
89
95
|
// cli.SendPresence(types.PresenceAvailable)
|
|
90
96
|
func (cli *Client) SubscribePresence(jid types.JID) error {
|
|
97
|
+
if cli == nil {
|
|
98
|
+
return ErrClientIsNil
|
|
99
|
+
}
|
|
91
100
|
privacyToken, err := cli.Store.PrivacyTokens.GetPrivacyToken(context.TODO(), jid)
|
|
92
101
|
if err != nil {
|
|
93
102
|
return fmt.Errorf("failed to get privacy token: %w", err)
|