slidge-whatsapp 0.3.7__cp312-cp312-manylinux_2_41_aarch64.whl → 0.3.8__cp312-cp312-manylinux_2_41_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.
- slidge_whatsapp/config.py +7 -2
- slidge_whatsapp/contact.py +3 -2
- slidge_whatsapp/event.go +14 -9
- slidge_whatsapp/gateway.go +7 -1
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.h +182 -178
- slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +146 -142
- slidge_whatsapp/generated/whatsapp.c +1456 -1376
- slidge_whatsapp/generated/whatsapp.go +1069 -1045
- slidge_whatsapp/generated/whatsapp.py +1324 -1298
- slidge_whatsapp/generated/whatsapp_go.h +182 -178
- slidge_whatsapp/go.mod +6 -6
- slidge_whatsapp/go.sum +12 -12
- slidge_whatsapp/group.py +25 -0
- slidge_whatsapp/session.go +69 -67
- slidge_whatsapp/session.py +11 -1
- slidge_whatsapp/vendor/github.com/coder/websocket/LICENSE.txt +13 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/Makefile +18 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/README.md +162 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/accept.go +378 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/close.go +335 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/compress.go +234 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/conn.go +306 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/dial.go +347 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/doc.go +33 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/errors.go +8 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/frame.go +173 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/hijack.go +33 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/internal/bpool/bpool.go +25 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/internal/errd/wrap.go +14 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/internal/util/util.go +15 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/internal/wsjs/wsjs_js.go +169 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/mask.go +128 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/mask_amd64.s +127 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/mask_arm64.s +72 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/mask_asm.go +26 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/mask_go.go +7 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/netconn.go +233 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/netconn_js.go +11 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/netconn_notjs.go +19 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/read.go +540 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/stringer.go +91 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/write.go +384 -0
- slidge_whatsapp/vendor/github.com/coder/websocket/ws_js.go +598 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/func.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_amd64.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_arm64.go +3 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_loong64.go +1 -1
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +3 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +3 -0
- slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/value.go +4 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +18 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/broadcast.go +3 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +6 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +90 -80
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +14 -11
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +4 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +47 -48
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/handshake.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +79 -75
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +8 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaconn.go +1 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaretry.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +42 -40
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/newsletter.go +35 -32
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +2 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +2 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +19 -19
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +9 -8
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +9 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/privacysettings.go +4 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.pb.go +1145 -335
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.proto +78 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.pb.go +22 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.proto +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +104 -30
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +1037 -963
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +15 -8
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +40 -35
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +921 -653
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +44 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +9 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +193 -115
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +9 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/push.go +2 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +12 -12
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/request.go +25 -19
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +43 -27
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +4 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/constants.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/framesocket.go +43 -56
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/noisehandshake.go +9 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/socket/noisesocket.go +36 -22
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +24 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +12 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/appstate.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/upload.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +79 -40
- slidge_whatsapp/vendor/golang.org/x/sys/unix/mkerrors.sh +2 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +6 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux.go +359 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_linux.go +10 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux.go +31 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +15 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +76 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +37 -0
- slidge_whatsapp/vendor/modules.txt +12 -8
- {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/METADATA +1 -1
- {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/RECORD +145 -136
- slidge_whatsapp/vendor/github.com/gorilla/websocket/.gitignore +0 -25
- slidge_whatsapp/vendor/github.com/gorilla/websocket/AUTHORS +0 -9
- slidge_whatsapp/vendor/github.com/gorilla/websocket/LICENSE +0 -22
- slidge_whatsapp/vendor/github.com/gorilla/websocket/README.md +0 -33
- slidge_whatsapp/vendor/github.com/gorilla/websocket/client.go +0 -434
- slidge_whatsapp/vendor/github.com/gorilla/websocket/compression.go +0 -148
- slidge_whatsapp/vendor/github.com/gorilla/websocket/conn.go +0 -1238
- slidge_whatsapp/vendor/github.com/gorilla/websocket/doc.go +0 -227
- slidge_whatsapp/vendor/github.com/gorilla/websocket/join.go +0 -42
- slidge_whatsapp/vendor/github.com/gorilla/websocket/json.go +0 -60
- slidge_whatsapp/vendor/github.com/gorilla/websocket/mask.go +0 -55
- slidge_whatsapp/vendor/github.com/gorilla/websocket/mask_safe.go +0 -16
- slidge_whatsapp/vendor/github.com/gorilla/websocket/prepared.go +0 -102
- slidge_whatsapp/vendor/github.com/gorilla/websocket/proxy.go +0 -77
- slidge_whatsapp/vendor/github.com/gorilla/websocket/server.go +0 -365
- slidge_whatsapp/vendor/github.com/gorilla/websocket/tls_handshake.go +0 -21
- slidge_whatsapp/vendor/github.com/gorilla/websocket/tls_handshake_116.go +0 -21
- slidge_whatsapp/vendor/github.com/gorilla/websocket/util.go +0 -298
- slidge_whatsapp/vendor/github.com/gorilla/websocket/x_net_proxy.go +0 -473
- {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/WHEEL +0 -0
- {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/entry_points.txt +0 -0
- {slidge_whatsapp-0.3.7.dist-info → slidge_whatsapp-0.3.8.dist-info}/licenses/LICENSE +0 -0
|
@@ -21,8 +21,7 @@ import (
|
|
|
21
21
|
const InviteLinkPrefix = "https://chat.whatsapp.com/"
|
|
22
22
|
|
|
23
23
|
func (cli *Client) sendGroupIQ(ctx context.Context, iqType infoQueryType, jid types.JID, content waBinary.Node) (*waBinary.Node, error) {
|
|
24
|
-
return cli.sendIQ(infoQuery{
|
|
25
|
-
Context: ctx,
|
|
24
|
+
return cli.sendIQ(ctx, infoQuery{
|
|
26
25
|
Namespace: "w:g2",
|
|
27
26
|
Type: iqType,
|
|
28
27
|
To: jid,
|
|
@@ -135,8 +134,8 @@ func (cli *Client) CreateGroup(ctx context.Context, req ReqCreateGroup) (*types.
|
|
|
135
134
|
}
|
|
136
135
|
|
|
137
136
|
// UnlinkGroup removes a child group from a parent community.
|
|
138
|
-
func (cli *Client) UnlinkGroup(parent, child types.JID) error {
|
|
139
|
-
_, err := cli.sendGroupIQ(
|
|
137
|
+
func (cli *Client) UnlinkGroup(ctx context.Context, parent, child types.JID) error {
|
|
138
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, parent, waBinary.Node{
|
|
140
139
|
Tag: "unlink",
|
|
141
140
|
Attrs: waBinary.Attrs{"unlink_type": string(types.GroupLinkChangeTypeSub)},
|
|
142
141
|
Content: []waBinary.Node{{
|
|
@@ -150,8 +149,8 @@ func (cli *Client) UnlinkGroup(parent, child types.JID) error {
|
|
|
150
149
|
// LinkGroup adds an existing group as a child group in a community.
|
|
151
150
|
//
|
|
152
151
|
// To create a new group within a community, set LinkedParentJID in the CreateGroup request.
|
|
153
|
-
func (cli *Client) LinkGroup(parent, child types.JID) error {
|
|
154
|
-
_, err := cli.sendGroupIQ(
|
|
152
|
+
func (cli *Client) LinkGroup(ctx context.Context, parent, child types.JID) error {
|
|
153
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, parent, waBinary.Node{
|
|
155
154
|
Tag: "links",
|
|
156
155
|
Content: []waBinary.Node{{
|
|
157
156
|
Tag: "link",
|
|
@@ -166,8 +165,8 @@ func (cli *Client) LinkGroup(parent, child types.JID) error {
|
|
|
166
165
|
}
|
|
167
166
|
|
|
168
167
|
// LeaveGroup leaves the specified group on WhatsApp.
|
|
169
|
-
func (cli *Client) LeaveGroup(jid types.JID) error {
|
|
170
|
-
_, err := cli.sendGroupIQ(
|
|
168
|
+
func (cli *Client) LeaveGroup(ctx context.Context, jid types.JID) error {
|
|
169
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, types.GroupServerJID, waBinary.Node{
|
|
171
170
|
Tag: "leave",
|
|
172
171
|
Content: []waBinary.Node{{
|
|
173
172
|
Tag: "group",
|
|
@@ -187,7 +186,7 @@ const (
|
|
|
187
186
|
)
|
|
188
187
|
|
|
189
188
|
// UpdateGroupParticipants can be used to add, remove, promote and demote members in a WhatsApp group.
|
|
190
|
-
func (cli *Client) UpdateGroupParticipants(jid types.JID, participantChanges []types.JID, action ParticipantChange) ([]types.GroupParticipant, error) {
|
|
189
|
+
func (cli *Client) UpdateGroupParticipants(ctx context.Context, jid types.JID, participantChanges []types.JID, action ParticipantChange) ([]types.GroupParticipant, error) {
|
|
191
190
|
content := make([]waBinary.Node, len(participantChanges))
|
|
192
191
|
for i, participantJID := range participantChanges {
|
|
193
192
|
content[i] = waBinary.Node{
|
|
@@ -195,7 +194,7 @@ func (cli *Client) UpdateGroupParticipants(jid types.JID, participantChanges []t
|
|
|
195
194
|
Attrs: waBinary.Attrs{"jid": participantJID},
|
|
196
195
|
}
|
|
197
196
|
}
|
|
198
|
-
resp, err := cli.sendGroupIQ(
|
|
197
|
+
resp, err := cli.sendGroupIQ(ctx, iqSet, jid, waBinary.Node{
|
|
199
198
|
Tag: string(action),
|
|
200
199
|
Content: content,
|
|
201
200
|
})
|
|
@@ -215,8 +214,8 @@ func (cli *Client) UpdateGroupParticipants(jid types.JID, participantChanges []t
|
|
|
215
214
|
}
|
|
216
215
|
|
|
217
216
|
// GetGroupRequestParticipants gets the list of participants that have requested to join the group.
|
|
218
|
-
func (cli *Client) GetGroupRequestParticipants(jid types.JID) ([]types.GroupParticipantRequest, error) {
|
|
219
|
-
resp, err := cli.sendGroupIQ(
|
|
217
|
+
func (cli *Client) GetGroupRequestParticipants(ctx context.Context, jid types.JID) ([]types.GroupParticipantRequest, error) {
|
|
218
|
+
resp, err := cli.sendGroupIQ(ctx, iqGet, jid, waBinary.Node{
|
|
220
219
|
Tag: "membership_approval_requests",
|
|
221
220
|
})
|
|
222
221
|
if err != nil {
|
|
@@ -245,7 +244,7 @@ const (
|
|
|
245
244
|
)
|
|
246
245
|
|
|
247
246
|
// UpdateGroupRequestParticipants can be used to approve or reject requests to join the group.
|
|
248
|
-
func (cli *Client) UpdateGroupRequestParticipants(jid types.JID, participantChanges []types.JID, action ParticipantRequestChange) ([]types.GroupParticipant, error) {
|
|
247
|
+
func (cli *Client) UpdateGroupRequestParticipants(ctx context.Context, jid types.JID, participantChanges []types.JID, action ParticipantRequestChange) ([]types.GroupParticipant, error) {
|
|
249
248
|
content := make([]waBinary.Node, len(participantChanges))
|
|
250
249
|
for i, participantJID := range participantChanges {
|
|
251
250
|
content[i] = waBinary.Node{
|
|
@@ -253,7 +252,7 @@ func (cli *Client) UpdateGroupRequestParticipants(jid types.JID, participantChan
|
|
|
253
252
|
Attrs: waBinary.Attrs{"jid": participantJID},
|
|
254
253
|
}
|
|
255
254
|
}
|
|
256
|
-
resp, err := cli.sendGroupIQ(
|
|
255
|
+
resp, err := cli.sendGroupIQ(ctx, iqSet, jid, waBinary.Node{
|
|
257
256
|
Tag: "membership_requests_action",
|
|
258
257
|
Content: []waBinary.Node{{
|
|
259
258
|
Tag: string(action),
|
|
@@ -282,7 +281,7 @@ func (cli *Client) UpdateGroupRequestParticipants(jid types.JID, participantChan
|
|
|
282
281
|
// SetGroupPhoto updates the group picture/icon of the given group on WhatsApp.
|
|
283
282
|
// The avatar should be a JPEG photo, other formats may be rejected with ErrInvalidImageFormat.
|
|
284
283
|
// The bytes can be nil to remove the photo. Returns the new picture ID.
|
|
285
|
-
func (cli *Client) SetGroupPhoto(jid types.JID, avatar []byte) (string, error) {
|
|
284
|
+
func (cli *Client) SetGroupPhoto(ctx context.Context, jid types.JID, avatar []byte) (string, error) {
|
|
286
285
|
var content interface{}
|
|
287
286
|
if avatar != nil {
|
|
288
287
|
content = []waBinary.Node{{
|
|
@@ -291,7 +290,7 @@ func (cli *Client) SetGroupPhoto(jid types.JID, avatar []byte) (string, error) {
|
|
|
291
290
|
Content: avatar,
|
|
292
291
|
}}
|
|
293
292
|
}
|
|
294
|
-
resp, err := cli.sendIQ(infoQuery{
|
|
293
|
+
resp, err := cli.sendIQ(ctx, infoQuery{
|
|
295
294
|
Namespace: "w:profile:picture",
|
|
296
295
|
Type: iqSet,
|
|
297
296
|
To: types.ServerJID,
|
|
@@ -314,8 +313,8 @@ func (cli *Client) SetGroupPhoto(jid types.JID, avatar []byte) (string, error) {
|
|
|
314
313
|
}
|
|
315
314
|
|
|
316
315
|
// SetGroupName updates the name (subject) of the given group on WhatsApp.
|
|
317
|
-
func (cli *Client) SetGroupName(jid types.JID, name string) error {
|
|
318
|
-
_, err := cli.sendGroupIQ(
|
|
316
|
+
func (cli *Client) SetGroupName(ctx context.Context, jid types.JID, name string) error {
|
|
317
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, waBinary.Node{
|
|
319
318
|
Tag: "subject",
|
|
320
319
|
Content: []byte(name),
|
|
321
320
|
})
|
|
@@ -327,9 +326,9 @@ func (cli *Client) SetGroupName(jid types.JID, name string) error {
|
|
|
327
326
|
// The previousID and newID fields are optional. If the previous ID is not specified, this will
|
|
328
327
|
// automatically fetch the current group info to find the previous topic ID. If the new ID is not
|
|
329
328
|
// specified, one will be generated with Client.GenerateMessageID().
|
|
330
|
-
func (cli *Client) SetGroupTopic(jid types.JID, previousID, newID, topic string) error {
|
|
329
|
+
func (cli *Client) SetGroupTopic(ctx context.Context, jid types.JID, previousID, newID, topic string) error {
|
|
331
330
|
if previousID == "" {
|
|
332
|
-
oldInfo, err := cli.GetGroupInfo(jid)
|
|
331
|
+
oldInfo, err := cli.GetGroupInfo(ctx, jid)
|
|
333
332
|
if err != nil {
|
|
334
333
|
return fmt.Errorf("failed to get old group info to update topic: %v", err)
|
|
335
334
|
}
|
|
@@ -352,7 +351,7 @@ func (cli *Client) SetGroupTopic(jid types.JID, previousID, newID, topic string)
|
|
|
352
351
|
attrs["delete"] = "true"
|
|
353
352
|
content = nil
|
|
354
353
|
}
|
|
355
|
-
_, err := cli.sendGroupIQ(
|
|
354
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, waBinary.Node{
|
|
356
355
|
Tag: "description",
|
|
357
356
|
Attrs: attrs,
|
|
358
357
|
Content: content,
|
|
@@ -361,34 +360,34 @@ func (cli *Client) SetGroupTopic(jid types.JID, previousID, newID, topic string)
|
|
|
361
360
|
}
|
|
362
361
|
|
|
363
362
|
// SetGroupLocked changes whether the group is locked (i.e. whether only admins can modify group info).
|
|
364
|
-
func (cli *Client) SetGroupLocked(jid types.JID, locked bool) error {
|
|
363
|
+
func (cli *Client) SetGroupLocked(ctx context.Context, jid types.JID, locked bool) error {
|
|
365
364
|
tag := "locked"
|
|
366
365
|
if !locked {
|
|
367
366
|
tag = "unlocked"
|
|
368
367
|
}
|
|
369
|
-
_, err := cli.sendGroupIQ(
|
|
368
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, waBinary.Node{Tag: tag})
|
|
370
369
|
return err
|
|
371
370
|
}
|
|
372
371
|
|
|
373
372
|
// SetGroupAnnounce changes whether the group is in announce mode (i.e. whether only admins can send messages).
|
|
374
|
-
func (cli *Client) SetGroupAnnounce(jid types.JID, announce bool) error {
|
|
373
|
+
func (cli *Client) SetGroupAnnounce(ctx context.Context, jid types.JID, announce bool) error {
|
|
375
374
|
tag := "announcement"
|
|
376
375
|
if !announce {
|
|
377
376
|
tag = "not_announcement"
|
|
378
377
|
}
|
|
379
|
-
_, err := cli.sendGroupIQ(
|
|
378
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, waBinary.Node{Tag: tag})
|
|
380
379
|
return err
|
|
381
380
|
}
|
|
382
381
|
|
|
383
382
|
// GetGroupInviteLink requests the invite link to the group from the WhatsApp servers.
|
|
384
383
|
//
|
|
385
384
|
// If reset is true, then the old invite link will be revoked and a new one generated.
|
|
386
|
-
func (cli *Client) GetGroupInviteLink(jid types.JID, reset bool) (string, error) {
|
|
385
|
+
func (cli *Client) GetGroupInviteLink(ctx context.Context, jid types.JID, reset bool) (string, error) {
|
|
387
386
|
iqType := iqGet
|
|
388
387
|
if reset {
|
|
389
388
|
iqType = iqSet
|
|
390
389
|
}
|
|
391
|
-
resp, err := cli.sendGroupIQ(
|
|
390
|
+
resp, err := cli.sendGroupIQ(ctx, iqType, jid, waBinary.Node{Tag: "invite"})
|
|
392
391
|
if errors.Is(err, ErrIQNotAuthorized) {
|
|
393
392
|
return "", wrapIQError(ErrGroupInviteLinkUnauthorized, err)
|
|
394
393
|
} else if errors.Is(err, ErrIQNotFound) {
|
|
@@ -408,8 +407,8 @@ func (cli *Client) GetGroupInviteLink(jid types.JID, reset bool) (string, error)
|
|
|
408
407
|
// GetGroupInfoFromInvite gets the group info from an invite message.
|
|
409
408
|
//
|
|
410
409
|
// Note that this is specifically for invite messages, not invite links. Use GetGroupInfoFromLink for resolving chat.whatsapp.com links.
|
|
411
|
-
func (cli *Client) GetGroupInfoFromInvite(jid, inviter types.JID, code string, expiration int64) (*types.GroupInfo, error) {
|
|
412
|
-
resp, err := cli.sendGroupIQ(
|
|
410
|
+
func (cli *Client) GetGroupInfoFromInvite(ctx context.Context, jid, inviter types.JID, code string, expiration int64) (*types.GroupInfo, error) {
|
|
411
|
+
resp, err := cli.sendGroupIQ(ctx, iqGet, jid, waBinary.Node{
|
|
413
412
|
Tag: "query",
|
|
414
413
|
Content: []waBinary.Node{{
|
|
415
414
|
Tag: "add_request",
|
|
@@ -433,8 +432,8 @@ func (cli *Client) GetGroupInfoFromInvite(jid, inviter types.JID, code string, e
|
|
|
433
432
|
// JoinGroupWithInvite joins a group using an invite message.
|
|
434
433
|
//
|
|
435
434
|
// Note that this is specifically for invite messages, not invite links. Use JoinGroupWithLink for joining with chat.whatsapp.com links.
|
|
436
|
-
func (cli *Client) JoinGroupWithInvite(jid, inviter types.JID, code string, expiration int64) error {
|
|
437
|
-
_, err := cli.sendGroupIQ(
|
|
435
|
+
func (cli *Client) JoinGroupWithInvite(ctx context.Context, jid, inviter types.JID, code string, expiration int64) error {
|
|
436
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, waBinary.Node{
|
|
438
437
|
Tag: "accept",
|
|
439
438
|
Attrs: waBinary.Attrs{
|
|
440
439
|
"code": code,
|
|
@@ -447,9 +446,9 @@ func (cli *Client) JoinGroupWithInvite(jid, inviter types.JID, code string, expi
|
|
|
447
446
|
|
|
448
447
|
// GetGroupInfoFromLink resolves the given invite link and asks the WhatsApp servers for info about the group.
|
|
449
448
|
// This will not cause the user to join the group.
|
|
450
|
-
func (cli *Client) GetGroupInfoFromLink(code string) (*types.GroupInfo, error) {
|
|
449
|
+
func (cli *Client) GetGroupInfoFromLink(ctx context.Context, code string) (*types.GroupInfo, error) {
|
|
451
450
|
code = strings.TrimPrefix(code, InviteLinkPrefix)
|
|
452
|
-
resp, err := cli.sendGroupIQ(
|
|
451
|
+
resp, err := cli.sendGroupIQ(ctx, iqGet, types.GroupServerJID, waBinary.Node{
|
|
453
452
|
Tag: "invite",
|
|
454
453
|
Attrs: waBinary.Attrs{"code": code},
|
|
455
454
|
})
|
|
@@ -468,9 +467,9 @@ func (cli *Client) GetGroupInfoFromLink(code string) (*types.GroupInfo, error) {
|
|
|
468
467
|
}
|
|
469
468
|
|
|
470
469
|
// JoinGroupWithLink joins the group using the given invite link.
|
|
471
|
-
func (cli *Client) JoinGroupWithLink(code string) (types.JID, error) {
|
|
470
|
+
func (cli *Client) JoinGroupWithLink(ctx context.Context, code string) (types.JID, error) {
|
|
472
471
|
code = strings.TrimPrefix(code, InviteLinkPrefix)
|
|
473
|
-
resp, err := cli.sendGroupIQ(
|
|
472
|
+
resp, err := cli.sendGroupIQ(ctx, iqSet, types.GroupServerJID, waBinary.Node{
|
|
474
473
|
Tag: "invite",
|
|
475
474
|
Attrs: waBinary.Attrs{"code": code},
|
|
476
475
|
})
|
|
@@ -538,8 +537,8 @@ func (cli *Client) GetJoinedGroups(ctx context.Context) ([]*types.GroupInfo, err
|
|
|
538
537
|
}
|
|
539
538
|
|
|
540
539
|
// GetSubGroups gets the subgroups of the given community.
|
|
541
|
-
func (cli *Client) GetSubGroups(community types.JID) ([]*types.GroupLinkTarget, error) {
|
|
542
|
-
res, err := cli.sendGroupIQ(
|
|
540
|
+
func (cli *Client) GetSubGroups(ctx context.Context, community types.JID) ([]*types.GroupLinkTarget, error) {
|
|
541
|
+
res, err := cli.sendGroupIQ(ctx, iqGet, community, waBinary.Node{Tag: "sub_groups"})
|
|
543
542
|
if err != nil {
|
|
544
543
|
return nil, err
|
|
545
544
|
}
|
|
@@ -561,8 +560,8 @@ func (cli *Client) GetSubGroups(community types.JID) ([]*types.GroupLinkTarget,
|
|
|
561
560
|
}
|
|
562
561
|
|
|
563
562
|
// GetLinkedGroupsParticipants gets all the participants in the groups of the given community.
|
|
564
|
-
func (cli *Client) GetLinkedGroupsParticipants(community types.JID) ([]types.JID, error) {
|
|
565
|
-
res, err := cli.sendGroupIQ(
|
|
563
|
+
func (cli *Client) GetLinkedGroupsParticipants(ctx context.Context, community types.JID) ([]types.JID, error) {
|
|
564
|
+
res, err := cli.sendGroupIQ(ctx, iqGet, community, waBinary.Node{Tag: "linked_groups_participants"})
|
|
566
565
|
if err != nil {
|
|
567
566
|
return nil, err
|
|
568
567
|
}
|
|
@@ -572,7 +571,7 @@ func (cli *Client) GetLinkedGroupsParticipants(community types.JID) ([]types.JID
|
|
|
572
571
|
}
|
|
573
572
|
members, lidPairs := parseParticipantList(&participants)
|
|
574
573
|
if len(lidPairs) > 0 {
|
|
575
|
-
err = cli.Store.LIDs.PutManyLIDMappings(
|
|
574
|
+
err = cli.Store.LIDs.PutManyLIDMappings(ctx, lidPairs)
|
|
576
575
|
if err != nil {
|
|
577
576
|
cli.Log.Warnf("Failed to store LID mappings for community participants: %v", err)
|
|
578
577
|
}
|
|
@@ -581,8 +580,8 @@ func (cli *Client) GetLinkedGroupsParticipants(community types.JID) ([]types.JID
|
|
|
581
580
|
}
|
|
582
581
|
|
|
583
582
|
// GetGroupInfo requests basic info about a group chat from the WhatsApp servers.
|
|
584
|
-
func (cli *Client) GetGroupInfo(jid types.JID) (*types.GroupInfo, error) {
|
|
585
|
-
return cli.getGroupInfo(
|
|
583
|
+
func (cli *Client) GetGroupInfo(ctx context.Context, jid types.JID) (*types.GroupInfo, error) {
|
|
584
|
+
return cli.getGroupInfo(ctx, jid, true)
|
|
586
585
|
}
|
|
587
586
|
|
|
588
587
|
func (cli *Client) cacheGroupInfo(groupInfo *types.GroupInfo, lock bool) ([]store.LIDMapping, []store.RedactedPhoneEntry) {
|
|
@@ -1001,7 +1000,7 @@ func (cli *Client) parseGroupNotification(node *waBinary.Node) (any, []store.LID
|
|
|
1001
1000
|
}
|
|
1002
1001
|
|
|
1003
1002
|
// SetGroupJoinApprovalMode sets the group join approval mode to 'on' or 'off'.
|
|
1004
|
-
func (cli *Client) SetGroupJoinApprovalMode(jid types.JID, mode bool) error {
|
|
1003
|
+
func (cli *Client) SetGroupJoinApprovalMode(ctx context.Context, jid types.JID, mode bool) error {
|
|
1005
1004
|
modeStr := "off"
|
|
1006
1005
|
if mode {
|
|
1007
1006
|
modeStr = "on"
|
|
@@ -1017,12 +1016,12 @@ func (cli *Client) SetGroupJoinApprovalMode(jid types.JID, mode bool) error {
|
|
|
1017
1016
|
},
|
|
1018
1017
|
}
|
|
1019
1018
|
|
|
1020
|
-
_, err := cli.sendGroupIQ(
|
|
1019
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, content)
|
|
1021
1020
|
return err
|
|
1022
1021
|
}
|
|
1023
1022
|
|
|
1024
1023
|
// SetGroupMemberAddMode sets the group member add mode to 'admin_add' or 'all_member_add'.
|
|
1025
|
-
func (cli *Client) SetGroupMemberAddMode(jid types.JID, mode types.GroupMemberAddMode) error {
|
|
1024
|
+
func (cli *Client) SetGroupMemberAddMode(ctx context.Context, jid types.JID, mode types.GroupMemberAddMode) error {
|
|
1026
1025
|
if mode != types.GroupMemberAddModeAdmin && mode != types.GroupMemberAddModeAllMember {
|
|
1027
1026
|
return errors.New("invalid mode, must be 'admin_add' or 'all_member_add'")
|
|
1028
1027
|
}
|
|
@@ -1032,12 +1031,12 @@ func (cli *Client) SetGroupMemberAddMode(jid types.JID, mode types.GroupMemberAd
|
|
|
1032
1031
|
Content: []byte(mode),
|
|
1033
1032
|
}
|
|
1034
1033
|
|
|
1035
|
-
_, err := cli.sendGroupIQ(
|
|
1034
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, content)
|
|
1036
1035
|
return err
|
|
1037
1036
|
}
|
|
1038
1037
|
|
|
1039
1038
|
// SetGroupDescription updates the group description.
|
|
1040
|
-
func (cli *Client) SetGroupDescription(jid types.JID, description string) error {
|
|
1039
|
+
func (cli *Client) SetGroupDescription(ctx context.Context, jid types.JID, description string) error {
|
|
1041
1040
|
content := waBinary.Node{
|
|
1042
1041
|
Tag: "description",
|
|
1043
1042
|
Content: []waBinary.Node{
|
|
@@ -1048,6 +1047,6 @@ func (cli *Client) SetGroupDescription(jid types.JID, description string) error
|
|
|
1048
1047
|
},
|
|
1049
1048
|
}
|
|
1050
1049
|
|
|
1051
|
-
_, err := cli.sendGroupIQ(
|
|
1050
|
+
_, err := cli.sendGroupIQ(ctx, iqSet, jid, content)
|
|
1052
1051
|
return err
|
|
1053
1052
|
}
|
|
@@ -8,6 +8,7 @@ package whatsmeow
|
|
|
8
8
|
|
|
9
9
|
import (
|
|
10
10
|
"bytes"
|
|
11
|
+
"context"
|
|
11
12
|
"fmt"
|
|
12
13
|
"time"
|
|
13
14
|
|
|
@@ -26,7 +27,7 @@ const WACertIssuerSerial = 0
|
|
|
26
27
|
var WACertPubKey = [...]byte{0x14, 0x23, 0x75, 0x57, 0x4d, 0xa, 0x58, 0x71, 0x66, 0xaa, 0xe7, 0x1e, 0xbe, 0x51, 0x64, 0x37, 0xc4, 0xa2, 0x8b, 0x73, 0xe3, 0x69, 0x5c, 0x6c, 0xe1, 0xf7, 0xf9, 0x54, 0x5d, 0xa8, 0xee, 0x6b}
|
|
27
28
|
|
|
28
29
|
// doHandshake implements the Noise_XX_25519_AESGCM_SHA256 handshake for the WhatsApp web API.
|
|
29
|
-
func (cli *Client) doHandshake(fs *socket.FrameSocket, ephemeralKP keys.KeyPair) error {
|
|
30
|
+
func (cli *Client) doHandshake(ctx context.Context, fs *socket.FrameSocket, ephemeralKP keys.KeyPair) error {
|
|
30
31
|
nh := socket.NewNoiseHandshake()
|
|
31
32
|
nh.Start(socket.NoiseStartPattern, fs.Header)
|
|
32
33
|
nh.Authenticate(ephemeralKP.Pub[:])
|
|
@@ -117,7 +118,7 @@ func (cli *Client) doHandshake(fs *socket.FrameSocket, ephemeralKP keys.KeyPair)
|
|
|
117
118
|
return fmt.Errorf("failed to send handshake finish message: %w", err)
|
|
118
119
|
}
|
|
119
120
|
|
|
120
|
-
ns, err := nh.Finish(fs, cli.handleFrame, cli.onDisconnect)
|
|
121
|
+
ns, err := nh.Finish(ctx, fs, cli.handleFrame, cli.onDisconnect)
|
|
121
122
|
if err != nil {
|
|
122
123
|
return fmt.Errorf("failed to create noise socket: %w", err)
|
|
123
124
|
}
|
|
@@ -83,8 +83,12 @@ func (int *DangerousInternalClient) GetStatusBroadcastRecipients(ctx context.Con
|
|
|
83
83
|
return int.c.getStatusBroadcastRecipients(ctx)
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
func (int *DangerousInternalClient) HandleCallEvent(node *waBinary.Node) {
|
|
87
|
-
int.c.handleCallEvent(node)
|
|
86
|
+
func (int *DangerousInternalClient) HandleCallEvent(ctx context.Context, node *waBinary.Node) {
|
|
87
|
+
int.c.handleCallEvent(ctx, node)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
func (int *DangerousInternalClient) SetTransport(transport *http.Transport, opt SetProxyOptions) {
|
|
91
|
+
int.c.setTransport(transport, opt)
|
|
88
92
|
}
|
|
89
93
|
|
|
90
94
|
func (int *DangerousInternalClient) GetSocketWaitChan() <-chan struct{} {
|
|
@@ -103,16 +107,16 @@ func (int *DangerousInternalClient) GetOwnLID() types.JID {
|
|
|
103
107
|
return int.c.getOwnLID()
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
func (int *DangerousInternalClient) Connect() error {
|
|
107
|
-
return int.c.connect()
|
|
110
|
+
func (int *DangerousInternalClient) Connect(ctx context.Context) error {
|
|
111
|
+
return int.c.connect(ctx)
|
|
108
112
|
}
|
|
109
113
|
|
|
110
|
-
func (int *DangerousInternalClient) UnlockedConnect() error {
|
|
111
|
-
return int.c.unlockedConnect()
|
|
114
|
+
func (int *DangerousInternalClient) UnlockedConnect(ctx context.Context) error {
|
|
115
|
+
return int.c.unlockedConnect(ctx)
|
|
112
116
|
}
|
|
113
117
|
|
|
114
|
-
func (int *DangerousInternalClient) OnDisconnect(ns *socket.NoiseSocket, remote bool) {
|
|
115
|
-
int.c.onDisconnect(ns, remote)
|
|
118
|
+
func (int *DangerousInternalClient) OnDisconnect(ctx context.Context, ns *socket.NoiseSocket, remote bool) {
|
|
119
|
+
int.c.onDisconnect(ctx, ns, remote)
|
|
116
120
|
}
|
|
117
121
|
|
|
118
122
|
func (int *DangerousInternalClient) ExpectDisconnect() {
|
|
@@ -127,48 +131,48 @@ func (int *DangerousInternalClient) IsExpectedDisconnect() bool {
|
|
|
127
131
|
return int.c.isExpectedDisconnect()
|
|
128
132
|
}
|
|
129
133
|
|
|
130
|
-
func (int *DangerousInternalClient) AutoReconnect() {
|
|
131
|
-
int.c.autoReconnect()
|
|
134
|
+
func (int *DangerousInternalClient) AutoReconnect(ctx context.Context) {
|
|
135
|
+
int.c.autoReconnect(ctx)
|
|
132
136
|
}
|
|
133
137
|
|
|
134
138
|
func (int *DangerousInternalClient) UnlockedDisconnect() {
|
|
135
139
|
int.c.unlockedDisconnect()
|
|
136
140
|
}
|
|
137
141
|
|
|
138
|
-
func (int *DangerousInternalClient) HandleFrame(data []byte) {
|
|
139
|
-
int.c.handleFrame(data)
|
|
142
|
+
func (int *DangerousInternalClient) HandleFrame(ctx context.Context, data []byte) {
|
|
143
|
+
int.c.handleFrame(ctx, data)
|
|
140
144
|
}
|
|
141
145
|
|
|
142
|
-
func (int *DangerousInternalClient) HandlerQueueLoop(
|
|
143
|
-
int.c.handlerQueueLoop(
|
|
146
|
+
func (int *DangerousInternalClient) HandlerQueueLoop(evtCtx, connCtx context.Context) {
|
|
147
|
+
int.c.handlerQueueLoop(evtCtx, connCtx)
|
|
144
148
|
}
|
|
145
149
|
|
|
146
|
-
func (int *DangerousInternalClient) SendNodeAndGetData(node waBinary.Node) ([]byte, error) {
|
|
147
|
-
return int.c.sendNodeAndGetData(node)
|
|
150
|
+
func (int *DangerousInternalClient) SendNodeAndGetData(ctx context.Context, node waBinary.Node) ([]byte, error) {
|
|
151
|
+
return int.c.sendNodeAndGetData(ctx, node)
|
|
148
152
|
}
|
|
149
153
|
|
|
150
|
-
func (int *DangerousInternalClient) SendNode(node waBinary.Node) error {
|
|
151
|
-
return int.c.sendNode(node)
|
|
154
|
+
func (int *DangerousInternalClient) SendNode(ctx context.Context, node waBinary.Node) error {
|
|
155
|
+
return int.c.sendNode(ctx, node)
|
|
152
156
|
}
|
|
153
157
|
|
|
154
158
|
func (int *DangerousInternalClient) DispatchEvent(evt any) (handlerFailed bool) {
|
|
155
159
|
return int.c.dispatchEvent(evt)
|
|
156
160
|
}
|
|
157
161
|
|
|
158
|
-
func (int *DangerousInternalClient) HandleStreamError(node *waBinary.Node) {
|
|
159
|
-
int.c.handleStreamError(node)
|
|
162
|
+
func (int *DangerousInternalClient) HandleStreamError(ctx context.Context, node *waBinary.Node) {
|
|
163
|
+
int.c.handleStreamError(ctx, node)
|
|
160
164
|
}
|
|
161
165
|
|
|
162
|
-
func (int *DangerousInternalClient) HandleIB(node *waBinary.Node) {
|
|
163
|
-
int.c.handleIB(node)
|
|
166
|
+
func (int *DangerousInternalClient) HandleIB(ctx context.Context, node *waBinary.Node) {
|
|
167
|
+
int.c.handleIB(ctx, node)
|
|
164
168
|
}
|
|
165
169
|
|
|
166
|
-
func (int *DangerousInternalClient) HandleConnectFailure(node *waBinary.Node) {
|
|
167
|
-
int.c.handleConnectFailure(node)
|
|
170
|
+
func (int *DangerousInternalClient) HandleConnectFailure(ctx context.Context, node *waBinary.Node) {
|
|
171
|
+
int.c.handleConnectFailure(ctx, node)
|
|
168
172
|
}
|
|
169
173
|
|
|
170
|
-
func (int *DangerousInternalClient) HandleConnectSuccess(node *waBinary.Node) {
|
|
171
|
-
int.c.handleConnectSuccess(node)
|
|
174
|
+
func (int *DangerousInternalClient) HandleConnectSuccess(ctx context.Context, node *waBinary.Node) {
|
|
175
|
+
int.c.handleConnectSuccess(ctx, node)
|
|
172
176
|
}
|
|
173
177
|
|
|
174
178
|
func (int *DangerousInternalClient) DownloadAndDecrypt(ctx context.Context, url string, mediaKey []byte, appInfo MediaType, fileLength int, fileEncSHA256, fileSHA256 []byte) (data []byte, err error) {
|
|
@@ -243,12 +247,12 @@ func (int *DangerousInternalClient) ParseGroupNotification(node *waBinary.Node)
|
|
|
243
247
|
return int.c.parseGroupNotification(node)
|
|
244
248
|
}
|
|
245
249
|
|
|
246
|
-
func (int *DangerousInternalClient) DoHandshake(fs *socket.FrameSocket, ephemeralKP keys.KeyPair) error {
|
|
247
|
-
return int.c.doHandshake(fs, ephemeralKP)
|
|
250
|
+
func (int *DangerousInternalClient) DoHandshake(ctx context.Context, fs *socket.FrameSocket, ephemeralKP keys.KeyPair) error {
|
|
251
|
+
return int.c.doHandshake(ctx, fs, ephemeralKP)
|
|
248
252
|
}
|
|
249
253
|
|
|
250
|
-
func (int *DangerousInternalClient) KeepAliveLoop(ctx context.Context) {
|
|
251
|
-
int.c.keepAliveLoop(ctx)
|
|
254
|
+
func (int *DangerousInternalClient) KeepAliveLoop(ctx, connCtx context.Context) {
|
|
255
|
+
int.c.keepAliveLoop(ctx, connCtx)
|
|
252
256
|
}
|
|
253
257
|
|
|
254
258
|
func (int *DangerousInternalClient) SendKeepAlive(ctx context.Context) (isSuccess, shouldContinue bool) {
|
|
@@ -267,8 +271,8 @@ func (int *DangerousInternalClient) HandleMediaRetryNotification(ctx context.Con
|
|
|
267
271
|
int.c.handleMediaRetryNotification(ctx, node)
|
|
268
272
|
}
|
|
269
273
|
|
|
270
|
-
func (int *DangerousInternalClient) HandleEncryptedMessage(node *waBinary.Node) {
|
|
271
|
-
int.c.handleEncryptedMessage(node)
|
|
274
|
+
func (int *DangerousInternalClient) HandleEncryptedMessage(ctx context.Context, node *waBinary.Node) {
|
|
275
|
+
int.c.handleEncryptedMessage(ctx, node)
|
|
272
276
|
}
|
|
273
277
|
|
|
274
278
|
func (int *DangerousInternalClient) ParseMessageSource(node *waBinary.Node, requireParticipant bool) (source types.MessageSource, err error) {
|
|
@@ -363,8 +367,8 @@ func (int *DangerousInternalClient) HandleDecryptedMessage(ctx context.Context,
|
|
|
363
367
|
return int.c.handleDecryptedMessage(ctx, info, msg, retryCount)
|
|
364
368
|
}
|
|
365
369
|
|
|
366
|
-
func (int *DangerousInternalClient) SendProtocolMessageReceipt(id types.MessageID, msgType types.ReceiptType) {
|
|
367
|
-
int.c.sendProtocolMessageReceipt(id, msgType)
|
|
370
|
+
func (int *DangerousInternalClient) SendProtocolMessageReceipt(ctx context.Context, id types.MessageID, msgType types.ReceiptType) {
|
|
371
|
+
int.c.sendProtocolMessageReceipt(ctx, id, msgType)
|
|
368
372
|
}
|
|
369
373
|
|
|
370
374
|
func (int *DangerousInternalClient) DecryptMsgSecret(ctx context.Context, msg *events.Message, useCase MsgSecretType, encrypted messageEncryptedSecret, origMsgKey *waCommon.MessageKey) ([]byte, error) {
|
|
@@ -383,8 +387,8 @@ func (int *DangerousInternalClient) SendMexIQ(ctx context.Context, queryID strin
|
|
|
383
387
|
return int.c.sendMexIQ(ctx, queryID, variables)
|
|
384
388
|
}
|
|
385
389
|
|
|
386
|
-
func (int *DangerousInternalClient) GetNewsletterInfo(input map[string]any, fetchViewerMeta bool) (*types.NewsletterMetadata, error) {
|
|
387
|
-
return int.c.getNewsletterInfo(input, fetchViewerMeta)
|
|
390
|
+
func (int *DangerousInternalClient) GetNewsletterInfo(ctx context.Context, input map[string]any, fetchViewerMeta bool) (*types.NewsletterMetadata, error) {
|
|
391
|
+
return int.c.getNewsletterInfo(ctx, input, fetchViewerMeta)
|
|
388
392
|
}
|
|
389
393
|
|
|
390
394
|
func (int *DangerousInternalClient) HandleEncryptNotification(ctx context.Context, node *waBinary.Node) {
|
|
@@ -439,8 +443,8 @@ func (int *DangerousInternalClient) HandleStatusNotification(ctx context.Context
|
|
|
439
443
|
int.c.handleStatusNotification(ctx, node)
|
|
440
444
|
}
|
|
441
445
|
|
|
442
|
-
func (int *DangerousInternalClient) HandleNotification(node *waBinary.Node) {
|
|
443
|
-
int.c.handleNotification(node)
|
|
446
|
+
func (int *DangerousInternalClient) HandleNotification(ctx context.Context, node *waBinary.Node) {
|
|
447
|
+
int.c.handleNotification(ctx, node)
|
|
444
448
|
}
|
|
445
449
|
|
|
446
450
|
func (int *DangerousInternalClient) TryHandleCodePairNotification(ctx context.Context, parentNode *waBinary.Node) {
|
|
@@ -451,36 +455,36 @@ func (int *DangerousInternalClient) HandleCodePairNotification(ctx context.Conte
|
|
|
451
455
|
return int.c.handleCodePairNotification(ctx, parentNode)
|
|
452
456
|
}
|
|
453
457
|
|
|
454
|
-
func (int *DangerousInternalClient) HandleIQ(node *waBinary.Node) {
|
|
455
|
-
int.c.handleIQ(node)
|
|
458
|
+
func (int *DangerousInternalClient) HandleIQ(ctx context.Context, node *waBinary.Node) {
|
|
459
|
+
int.c.handleIQ(ctx, node)
|
|
456
460
|
}
|
|
457
461
|
|
|
458
|
-
func (int *DangerousInternalClient) HandlePairDevice(node *waBinary.Node) {
|
|
459
|
-
int.c.handlePairDevice(node)
|
|
462
|
+
func (int *DangerousInternalClient) HandlePairDevice(ctx context.Context, node *waBinary.Node) {
|
|
463
|
+
int.c.handlePairDevice(ctx, node)
|
|
460
464
|
}
|
|
461
465
|
|
|
462
466
|
func (int *DangerousInternalClient) MakeQRData(ref string) string {
|
|
463
467
|
return int.c.makeQRData(ref)
|
|
464
468
|
}
|
|
465
469
|
|
|
466
|
-
func (int *DangerousInternalClient) HandlePairSuccess(node *waBinary.Node) {
|
|
467
|
-
int.c.handlePairSuccess(node)
|
|
470
|
+
func (int *DangerousInternalClient) HandlePairSuccess(ctx context.Context, node *waBinary.Node) {
|
|
471
|
+
int.c.handlePairSuccess(ctx, node)
|
|
468
472
|
}
|
|
469
473
|
|
|
470
474
|
func (int *DangerousInternalClient) HandlePair(ctx context.Context, deviceIdentityBytes []byte, reqID, businessName, platform string, jid, lid types.JID) error {
|
|
471
475
|
return int.c.handlePair(ctx, deviceIdentityBytes, reqID, businessName, platform, jid, lid)
|
|
472
476
|
}
|
|
473
477
|
|
|
474
|
-
func (int *DangerousInternalClient) SendPairError(id string, code int, text string) {
|
|
475
|
-
int.c.sendPairError(id, code, text)
|
|
478
|
+
func (int *DangerousInternalClient) SendPairError(ctx context.Context, id string, code int, text string) {
|
|
479
|
+
int.c.sendPairError(ctx, id, code, text)
|
|
476
480
|
}
|
|
477
481
|
|
|
478
482
|
func (int *DangerousInternalClient) GetServerPreKeyCount(ctx context.Context) (int, error) {
|
|
479
483
|
return int.c.getServerPreKeyCount(ctx)
|
|
480
484
|
}
|
|
481
485
|
|
|
482
|
-
func (int *DangerousInternalClient) UploadPreKeys(ctx context.Context) {
|
|
483
|
-
int.c.uploadPreKeys(ctx)
|
|
486
|
+
func (int *DangerousInternalClient) UploadPreKeys(ctx context.Context, initialUpload bool) {
|
|
487
|
+
int.c.uploadPreKeys(ctx, initialUpload)
|
|
484
488
|
}
|
|
485
489
|
|
|
486
490
|
func (int *DangerousInternalClient) FetchPreKeysNoError(ctx context.Context, retryDevices []types.JID) map[types.JID]*prekey.Bundle {
|
|
@@ -491,12 +495,12 @@ func (int *DangerousInternalClient) FetchPreKeys(ctx context.Context, users []ty
|
|
|
491
495
|
return int.c.fetchPreKeys(ctx, users)
|
|
492
496
|
}
|
|
493
497
|
|
|
494
|
-
func (int *DangerousInternalClient) HandleChatState(node *waBinary.Node) {
|
|
495
|
-
int.c.handleChatState(node)
|
|
498
|
+
func (int *DangerousInternalClient) HandleChatState(ctx context.Context, node *waBinary.Node) {
|
|
499
|
+
int.c.handleChatState(ctx, node)
|
|
496
500
|
}
|
|
497
501
|
|
|
498
|
-
func (int *DangerousInternalClient) HandlePresence(node *waBinary.Node) {
|
|
499
|
-
int.c.handlePresence(node)
|
|
502
|
+
func (int *DangerousInternalClient) HandlePresence(ctx context.Context, node *waBinary.Node) {
|
|
503
|
+
int.c.handlePresence(ctx, node)
|
|
500
504
|
}
|
|
501
505
|
|
|
502
506
|
func (int *DangerousInternalClient) ParsePrivacySettings(privacyNode *waBinary.Node, settings *types.PrivacySettings) *events.PrivacySettings {
|
|
@@ -507,8 +511,8 @@ func (int *DangerousInternalClient) HandlePrivacySettingsNotification(ctx contex
|
|
|
507
511
|
int.c.handlePrivacySettingsNotification(ctx, privacyNode)
|
|
508
512
|
}
|
|
509
513
|
|
|
510
|
-
func (int *DangerousInternalClient) HandleReceipt(node *waBinary.Node) {
|
|
511
|
-
int.c.handleReceipt(node)
|
|
514
|
+
func (int *DangerousInternalClient) HandleReceipt(ctx context.Context, node *waBinary.Node) {
|
|
515
|
+
int.c.handleReceipt(ctx, node)
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
func (int *DangerousInternalClient) HandleGroupedReceipt(partialReceipt events.Receipt, participants *waBinary.Node) {
|
|
@@ -527,12 +531,12 @@ func (int *DangerousInternalClient) MaybeDeferredAck(ctx context.Context, node *
|
|
|
527
531
|
return int.c.maybeDeferredAck(ctx, node)
|
|
528
532
|
}
|
|
529
533
|
|
|
530
|
-
func (int *DangerousInternalClient) SendAck(node *waBinary.Node, error int) {
|
|
531
|
-
int.c.sendAck(node, error)
|
|
534
|
+
func (int *DangerousInternalClient) SendAck(ctx context.Context, node *waBinary.Node, error int) {
|
|
535
|
+
int.c.sendAck(ctx, node, error)
|
|
532
536
|
}
|
|
533
537
|
|
|
534
|
-
func (int *DangerousInternalClient) SendMessageReceipt(info *types.MessageInfo, node *waBinary.Node) {
|
|
535
|
-
int.c.sendMessageReceipt(info, node)
|
|
538
|
+
func (int *DangerousInternalClient) SendMessageReceipt(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) {
|
|
539
|
+
int.c.sendMessageReceipt(ctx, info, node)
|
|
536
540
|
}
|
|
537
541
|
|
|
538
542
|
func (int *DangerousInternalClient) GenerateRequestID() string {
|
|
@@ -551,24 +555,24 @@ func (int *DangerousInternalClient) CancelResponse(reqID string, ch chan *waBina
|
|
|
551
555
|
int.c.cancelResponse(reqID, ch)
|
|
552
556
|
}
|
|
553
557
|
|
|
554
|
-
func (int *DangerousInternalClient) ReceiveResponse(data *waBinary.Node) bool {
|
|
555
|
-
return int.c.receiveResponse(data)
|
|
558
|
+
func (int *DangerousInternalClient) ReceiveResponse(ctx context.Context, data *waBinary.Node) bool {
|
|
559
|
+
return int.c.receiveResponse(ctx, data)
|
|
556
560
|
}
|
|
557
561
|
|
|
558
|
-
func (int *DangerousInternalClient) SendIQAsyncAndGetData(query *infoQuery) (<-chan *waBinary.Node, []byte, error) {
|
|
559
|
-
return int.c.sendIQAsyncAndGetData(query)
|
|
562
|
+
func (int *DangerousInternalClient) SendIQAsyncAndGetData(ctx context.Context, query *infoQuery) (<-chan *waBinary.Node, []byte, error) {
|
|
563
|
+
return int.c.sendIQAsyncAndGetData(ctx, query)
|
|
560
564
|
}
|
|
561
565
|
|
|
562
|
-
func (int *DangerousInternalClient) SendIQAsync(query infoQuery) (<-chan *waBinary.Node, error) {
|
|
563
|
-
return int.c.sendIQAsync(query)
|
|
566
|
+
func (int *DangerousInternalClient) SendIQAsync(ctx context.Context, query infoQuery) (<-chan *waBinary.Node, error) {
|
|
567
|
+
return int.c.sendIQAsync(ctx, query)
|
|
564
568
|
}
|
|
565
569
|
|
|
566
|
-
func (int *DangerousInternalClient) SendIQ(query infoQuery) (*waBinary.Node, error) {
|
|
567
|
-
return int.c.sendIQ(query)
|
|
570
|
+
func (int *DangerousInternalClient) SendIQ(ctx context.Context, query infoQuery) (*waBinary.Node, error) {
|
|
571
|
+
return int.c.sendIQ(ctx, query)
|
|
568
572
|
}
|
|
569
573
|
|
|
570
|
-
func (int *DangerousInternalClient) RetryFrame(reqType, id string, data []byte, origResp *waBinary.Node,
|
|
571
|
-
return int.c.retryFrame(reqType, id, data, origResp,
|
|
574
|
+
func (int *DangerousInternalClient) RetryFrame(ctx context.Context, reqType, id string, data []byte, origResp *waBinary.Node, timeout time.Duration) (*waBinary.Node, error) {
|
|
575
|
+
return int.c.retryFrame(ctx, reqType, id, data, origResp, timeout)
|
|
572
576
|
}
|
|
573
577
|
|
|
574
578
|
func (int *DangerousInternalClient) AddRecentMessage(to types.JID, id types.MessageID, wa *waE2E.Message, fb *waMsgApplication.MessageApplication) {
|
|
@@ -635,8 +639,8 @@ func (int *DangerousInternalClient) EncryptMessageForDeviceV3(ctx context.Contex
|
|
|
635
639
|
return int.c.encryptMessageForDeviceV3(ctx, payload, skdm, dsm, to, bundle, extraAttrs)
|
|
636
640
|
}
|
|
637
641
|
|
|
638
|
-
func (int *DangerousInternalClient) SendNewsletter(to types.JID, id types.MessageID, message *waE2E.Message, mediaID string, timings *MessageDebugTimings) ([]byte, error) {
|
|
639
|
-
return int.c.sendNewsletter(to, id, message, mediaID, timings)
|
|
642
|
+
func (int *DangerousInternalClient) SendNewsletter(ctx context.Context, to types.JID, id types.MessageID, message *waE2E.Message, mediaID string, timings *MessageDebugTimings) ([]byte, error) {
|
|
643
|
+
return int.c.sendNewsletter(ctx, to, id, message, mediaID, timings)
|
|
640
644
|
}
|
|
641
645
|
|
|
642
646
|
func (int *DangerousInternalClient) SendGroup(ctx context.Context, ownID, to types.JID, participants []types.JID, id types.MessageID, message *waE2E.Message, timings *MessageDebugTimings, extraParams nodeExtraParams) (string, []byte, error) {
|
|
@@ -647,7 +651,7 @@ func (int *DangerousInternalClient) SendPeerMessage(ctx context.Context, to type
|
|
|
647
651
|
return int.c.sendPeerMessage(ctx, to, id, message, timings)
|
|
648
652
|
}
|
|
649
653
|
|
|
650
|
-
func (int *DangerousInternalClient) SendDM(ctx context.Context, ownID, to types.JID, id types.MessageID, message *waE2E.Message, timings *MessageDebugTimings, extraParams nodeExtraParams) ([]byte, error) {
|
|
654
|
+
func (int *DangerousInternalClient) SendDM(ctx context.Context, ownID, to types.JID, id types.MessageID, message *waE2E.Message, timings *MessageDebugTimings, extraParams nodeExtraParams) (string, []byte, error) {
|
|
651
655
|
return int.c.sendDM(ctx, ownID, to, id, message, timings, extraParams)
|
|
652
656
|
}
|
|
653
657
|
|
|
@@ -691,12 +695,12 @@ func (int *DangerousInternalClient) HandleHistoricalPushNames(ctx context.Contex
|
|
|
691
695
|
int.c.handleHistoricalPushNames(ctx, names)
|
|
692
696
|
}
|
|
693
697
|
|
|
694
|
-
func (int *DangerousInternalClient) UpdatePushName(ctx context.Context, user types.JID, messageInfo *types.MessageInfo, name string) {
|
|
695
|
-
int.c.updatePushName(ctx, user, messageInfo, name)
|
|
698
|
+
func (int *DangerousInternalClient) UpdatePushName(ctx context.Context, user, userAlt types.JID, messageInfo *types.MessageInfo, name string) {
|
|
699
|
+
int.c.updatePushName(ctx, user, userAlt, messageInfo, name)
|
|
696
700
|
}
|
|
697
701
|
|
|
698
|
-
func (int *DangerousInternalClient) UpdateBusinessName(ctx context.Context, user types.JID, messageInfo *types.MessageInfo, name string) {
|
|
699
|
-
int.c.updateBusinessName(ctx, user, messageInfo, name)
|
|
702
|
+
func (int *DangerousInternalClient) UpdateBusinessName(ctx context.Context, user, userAlt types.JID, messageInfo *types.MessageInfo, name string) {
|
|
703
|
+
int.c.updateBusinessName(ctx, user, userAlt, messageInfo, name)
|
|
700
704
|
}
|
|
701
705
|
|
|
702
706
|
func (int *DangerousInternalClient) GetFBIDDevicesInternal(ctx context.Context, jids []types.JID) (*waBinary.Node, error) {
|