slidge-whatsapp 0.2.7__cp311-cp311-manylinux_2_36_aarch64.whl → 0.3.0b0__cp311-cp311-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-311-aarch64-linux-gnu.h +175 -158
- slidge_whatsapp/generated/_whatsapp.cpython-311-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +135 -121
- slidge_whatsapp/generated/whatsapp.c +1699 -1427
- slidge_whatsapp/generated/whatsapp.go +846 -735
- slidge_whatsapp/generated/whatsapp.py +1216 -1091
- slidge_whatsapp/generated/whatsapp_go.h +175 -158
- 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
slidge_whatsapp/contact.py
CHANGED
|
@@ -2,6 +2,7 @@ from datetime import datetime, timezone
|
|
|
2
2
|
from typing import TYPE_CHECKING
|
|
3
3
|
|
|
4
4
|
from slidge import LegacyContact, LegacyRoster
|
|
5
|
+
from slidge.util.types import Avatar
|
|
5
6
|
from slixmpp.exceptions import XMPPError
|
|
6
7
|
|
|
7
8
|
from . import config
|
|
@@ -28,6 +29,12 @@ class Contact(LegacyContact[str]):
|
|
|
28
29
|
else:
|
|
29
30
|
self.online(last_seen=last_seen)
|
|
30
31
|
|
|
32
|
+
async def update_info(self) -> None:
|
|
33
|
+
if whatsapp.IsAnonymousJID(self.legacy_id):
|
|
34
|
+
self.log.error(
|
|
35
|
+
"Contact for anonymous participant added: %s", self.legacy_id
|
|
36
|
+
)
|
|
37
|
+
|
|
31
38
|
|
|
32
39
|
class Roster(LegacyRoster[str, Contact]):
|
|
33
40
|
session: "Session"
|
|
@@ -54,9 +61,12 @@ class Roster(LegacyRoster[str, Contact]):
|
|
|
54
61
|
contact.name = data.Name
|
|
55
62
|
contact.is_friend = True
|
|
56
63
|
try:
|
|
57
|
-
|
|
58
|
-
if
|
|
59
|
-
|
|
64
|
+
unique_id = ""
|
|
65
|
+
if contact.avatar is not None:
|
|
66
|
+
unique_id = contact.avatar.unique_id or ""
|
|
67
|
+
avatar = self.session.whatsapp.GetAvatar(data.JID, unique_id)
|
|
68
|
+
if avatar.URL and unique_id != avatar.ID:
|
|
69
|
+
await contact.set_avatar(Avatar(url=avatar.URL, unique_id=avatar.ID))
|
|
60
70
|
elif avatar.URL == "" and avatar.ID == "":
|
|
61
71
|
await contact.set_avatar(None)
|
|
62
72
|
except RuntimeError as err:
|
slidge_whatsapp/event.go
CHANGED
|
@@ -46,6 +46,7 @@ type EventPayload struct {
|
|
|
46
46
|
QRCode string
|
|
47
47
|
PairDeviceID string
|
|
48
48
|
Connect Connect
|
|
49
|
+
LoggedOut LoggedOut
|
|
49
50
|
Contact Contact
|
|
50
51
|
Presence Presence
|
|
51
52
|
Message Message
|
|
@@ -66,6 +67,11 @@ type Connect struct {
|
|
|
66
67
|
Error string // The connection error, if any.
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
// LoggedOut repreents event data related to an explicit or implicit log-out event.
|
|
71
|
+
type LoggedOut struct {
|
|
72
|
+
Reason string // The human-readable reason for logging out, if any.
|
|
73
|
+
}
|
|
74
|
+
|
|
69
75
|
// A Avatar represents a small image set for a Contact or Group.
|
|
70
76
|
type Avatar struct {
|
|
71
77
|
ID string // The unique ID for this avatar, used for persistent caching.
|
|
@@ -82,10 +88,25 @@ type Contact struct {
|
|
|
82
88
|
// NewContactEvent returns event data meant for [Session.propagateEvent] for the contact information
|
|
83
89
|
// given. Unknown or invalid contact information will return an [EventUnknown] event with nil data.
|
|
84
90
|
func newContactEvent(jid types.JID, info types.ContactInfo) (EventKind, *EventPayload) {
|
|
85
|
-
|
|
86
|
-
|
|
91
|
+
contact := newContact(jid, info)
|
|
92
|
+
if contact.JID == "" {
|
|
93
|
+
return EventUnknown, nil
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return EventContact, &EventPayload{Contact: contact}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// NewContact returns a concrete [Contact] instance for the JID and additional information given.
|
|
100
|
+
// In cases where a valid contact can't be returned, [Contact.JID] will be left empty.
|
|
101
|
+
func newContact(jid types.JID, info types.ContactInfo) Contact {
|
|
102
|
+
// Don't instantiate hidden contacts, as these are better handled as group participants
|
|
103
|
+
if jid.Server == types.HiddenUserServer {
|
|
104
|
+
return Contact{}
|
|
87
105
|
}
|
|
88
106
|
|
|
107
|
+
// Find valid contact name from list of alternatives, or return empty contact if none could
|
|
108
|
+
// be found.
|
|
109
|
+
var contact = Contact{JID: jid.ToNonAD().String()}
|
|
89
110
|
for _, n := range []string{info.FullName, info.FirstName, info.BusinessName, info.PushName} {
|
|
90
111
|
if n != "" {
|
|
91
112
|
contact.Name = n
|
|
@@ -93,12 +114,11 @@ func newContactEvent(jid types.JID, info types.ContactInfo) (EventKind, *EventPa
|
|
|
93
114
|
}
|
|
94
115
|
}
|
|
95
116
|
|
|
96
|
-
// Don't attempt to synchronize contacts with no user-readable name.
|
|
97
117
|
if contact.Name == "" {
|
|
98
|
-
return
|
|
118
|
+
return Contact{}
|
|
99
119
|
}
|
|
100
120
|
|
|
101
|
-
return
|
|
121
|
+
return contact
|
|
102
122
|
}
|
|
103
123
|
|
|
104
124
|
// PresenceKind represents the different kinds of activity states possible in WhatsApp.
|
|
@@ -169,9 +189,11 @@ type Message struct {
|
|
|
169
189
|
Location Location // The location metadata for messages, if any.
|
|
170
190
|
Poll Poll // The multiple-choice poll contained in the message, if any.
|
|
171
191
|
Album Album // The image album message, if any.
|
|
192
|
+
GroupInvite Group // Group information for the invite group included in this message, if any.
|
|
172
193
|
MentionJIDs []string // A list of JIDs mentioned in this message, if any.
|
|
173
194
|
Receipts []Receipt // The receipt statuses for the message, typically provided alongside historical messages.
|
|
174
195
|
Reactions []Message // Reactions attached to message, typically provided alongside historical messages.
|
|
196
|
+
IsHistory bool // Whether or not the message is derived from message history.
|
|
175
197
|
}
|
|
176
198
|
|
|
177
199
|
// A Attachment represents additional binary data (e.g. images, videos, documents) provided alongside
|
|
@@ -253,14 +275,13 @@ type Album struct {
|
|
|
253
275
|
|
|
254
276
|
// NewMessageEvent returns event data meant for [Session.propagateEvent] for the primive message
|
|
255
277
|
// event given. Unknown or invalid messages will return an [EventUnknown] event with nil data.
|
|
256
|
-
func newMessageEvent(client *whatsmeow.Client, evt *events.Message) (EventKind, *EventPayload) {
|
|
278
|
+
func newMessageEvent(ctx context.Context, client *whatsmeow.Client, evt *events.Message) (EventKind, *EventPayload) {
|
|
257
279
|
// Set basic data for message, to be potentially amended depending on the concrete version of
|
|
258
280
|
// the underlying message.
|
|
259
|
-
var ctx = context.Background()
|
|
260
281
|
var message = Message{
|
|
261
282
|
Kind: MessagePlain,
|
|
262
283
|
ID: evt.Info.ID,
|
|
263
|
-
JID: evt.Info.Sender.ToNonAD().String(),
|
|
284
|
+
JID: getPreferredJID(ctx, client, evt.Info.Sender, evt.Info.SenderAlt).ToNonAD().String(),
|
|
264
285
|
Body: evt.Message.GetConversation(),
|
|
265
286
|
Timestamp: evt.Info.Timestamp.Unix(),
|
|
266
287
|
IsCarbon: evt.Info.IsFromMe,
|
|
@@ -378,7 +399,18 @@ func newMessageEvent(client *whatsmeow.Client, evt *events.Message) (EventKind,
|
|
|
378
399
|
message.Body = e.GetText()
|
|
379
400
|
}
|
|
380
401
|
|
|
381
|
-
|
|
402
|
+
// Handle group-chat invite link in text message.
|
|
403
|
+
if code, ok := strings.CutPrefix(e.GetMatchedText(), whatsmeow.InviteLinkPrefix); ok {
|
|
404
|
+
if info, err := client.GetGroupInfoFromLink(e.GetMatchedText()); err != nil {
|
|
405
|
+
client.Log.Errorf("Failed getting group info from invite: %s", err)
|
|
406
|
+
} else if _, err := client.JoinGroupWithLink(code); err != nil {
|
|
407
|
+
client.Log.Errorf("Failed joining group with invite: %s", err)
|
|
408
|
+
} else {
|
|
409
|
+
message.GroupInvite = newGroup(ctx, client, info)
|
|
410
|
+
}
|
|
411
|
+
} else {
|
|
412
|
+
message = getMessageWithContext(message, e.GetContextInfo())
|
|
413
|
+
}
|
|
382
414
|
}
|
|
383
415
|
|
|
384
416
|
// Ignore obviously invalid messages.
|
|
@@ -424,6 +456,7 @@ func getMessageAttachments(ctx context.Context, client *whatsmeow.Client, messag
|
|
|
424
456
|
message.GetVideoMessage(),
|
|
425
457
|
message.GetDocumentMessage(),
|
|
426
458
|
message.GetStickerMessage(),
|
|
459
|
+
message.GetPtvMessage(),
|
|
427
460
|
}
|
|
428
461
|
|
|
429
462
|
for _, msg := range kinds {
|
|
@@ -837,10 +870,9 @@ func getBaseMediaType(typ string) string {
|
|
|
837
870
|
//
|
|
838
871
|
// Typically, this will return [EventMessage] events with appropriate [Message] payloads; unknown or
|
|
839
872
|
// invalid messages will return an [EventUnknown] event with nil data.
|
|
840
|
-
func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (EventKind, *EventPayload) {
|
|
873
|
+
func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *waWeb.WebMessageInfo) (EventKind, *EventPayload) {
|
|
841
874
|
// Handle message as group message is remote JID is a group JID in the absence of any other,
|
|
842
875
|
// specific signal, or don't handle at all if no group JID is found.
|
|
843
|
-
var ctx = context.Background()
|
|
844
876
|
var jid = info.GetKey().GetRemoteJID()
|
|
845
877
|
if j, _ := types.ParseJID(jid); j.Server != types.GroupServer {
|
|
846
878
|
return EventUnknown, nil
|
|
@@ -855,6 +887,7 @@ func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (
|
|
|
855
887
|
Body: info.GetMessage().GetConversation(),
|
|
856
888
|
Timestamp: int64(info.GetMessageTimestamp()),
|
|
857
889
|
IsCarbon: info.GetKey().GetFromMe(),
|
|
890
|
+
IsHistory: true,
|
|
858
891
|
}
|
|
859
892
|
|
|
860
893
|
if info.Participant != nil {
|
|
@@ -1009,10 +1042,10 @@ type Receipt struct {
|
|
|
1009
1042
|
|
|
1010
1043
|
// NewReceiptEvent returns event data meant for [Session.propagateEvent] for the primive receipt
|
|
1011
1044
|
// event given. Unknown or invalid receipts will return an [EventUnknown] event with nil data.
|
|
1012
|
-
func newReceiptEvent(evt *events.Receipt) (EventKind, *EventPayload) {
|
|
1045
|
+
func newReceiptEvent(ctx context.Context, client *whatsmeow.Client, evt *events.Receipt) (EventKind, *EventPayload) {
|
|
1013
1046
|
var receipt = Receipt{
|
|
1014
1047
|
MessageIDs: slices.Clone(evt.MessageIDs),
|
|
1015
|
-
JID: evt.Sender.ToNonAD().String(),
|
|
1048
|
+
JID: getPreferredJID(ctx, client, evt.Sender, evt.SenderAlt).ToNonAD().String(),
|
|
1016
1049
|
Timestamp: evt.Timestamp.Unix(),
|
|
1017
1050
|
IsCarbon: evt.IsFromMe,
|
|
1018
1051
|
}
|
|
@@ -1059,14 +1092,15 @@ type Group struct {
|
|
|
1059
1092
|
Subject GroupSubject // The longer-form, user-defined description for this group.
|
|
1060
1093
|
Nickname string // Our own nickname in this group-chat.
|
|
1061
1094
|
Participants []GroupParticipant // The list of participant contacts for this group, including ourselves.
|
|
1095
|
+
InviteCode string // The code for inviting members to this group-chat.
|
|
1062
1096
|
}
|
|
1063
1097
|
|
|
1064
1098
|
// A GroupSubject represents the user-defined group description and attached metadata thereof, for a
|
|
1065
1099
|
// given [Group].
|
|
1066
1100
|
type GroupSubject struct {
|
|
1067
|
-
Subject
|
|
1068
|
-
SetAt
|
|
1069
|
-
|
|
1101
|
+
Subject string // The user-defined group description.
|
|
1102
|
+
SetAt int64 // The exact time this group description was set at, as a timestamp.
|
|
1103
|
+
SetBy string // The name of the user that set the subject.
|
|
1070
1104
|
}
|
|
1071
1105
|
|
|
1072
1106
|
// GroupParticipantAction represents the distinct set of actions that can be taken when encountering
|
|
@@ -1096,10 +1130,11 @@ func (a GroupParticipantAction) toParticipantChange() whatsmeow.ParticipantChang
|
|
|
1096
1130
|
}
|
|
1097
1131
|
|
|
1098
1132
|
// A GroupParticipant represents a contact who is currently joined in a given group. Participants in
|
|
1099
|
-
// WhatsApp can
|
|
1133
|
+
// WhatsApp can generally be derived back to their individual [Contact]; there are no anonymous groups
|
|
1100
1134
|
// in WhatsApp.
|
|
1101
1135
|
type GroupParticipant struct {
|
|
1102
1136
|
JID string // The WhatsApp JID for this participant.
|
|
1137
|
+
Nickname string // The user-set name for this participant, typically only set for anonymous participants.
|
|
1103
1138
|
Affiliation GroupAffiliation // The set of priviledges given to this specific participant.
|
|
1104
1139
|
Action GroupParticipantAction // The specific action to take for this participant; typically to add.
|
|
1105
1140
|
}
|
|
@@ -1107,35 +1142,42 @@ type GroupParticipant struct {
|
|
|
1107
1142
|
// NewGroupParticipant returns a [GroupParticipant], filling fields from the internal participant
|
|
1108
1143
|
// type. This is a no-op if [types.GroupParticipant.Error] is non-zero, and other fields may only
|
|
1109
1144
|
// be set optionally.
|
|
1110
|
-
func newGroupParticipant(
|
|
1111
|
-
if
|
|
1145
|
+
func newGroupParticipant(ctx context.Context, client *whatsmeow.Client, participant types.GroupParticipant) GroupParticipant {
|
|
1146
|
+
if participant.Error > 0 {
|
|
1112
1147
|
return GroupParticipant{}
|
|
1113
1148
|
}
|
|
1114
|
-
var
|
|
1115
|
-
|
|
1116
|
-
affiliation = GroupAffiliationOwner
|
|
1117
|
-
} else if p.IsAdmin {
|
|
1118
|
-
affiliation = GroupAffiliationAdmin
|
|
1149
|
+
var p = GroupParticipant{
|
|
1150
|
+
JID: participant.JID.ToNonAD().String(),
|
|
1119
1151
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1152
|
+
if participant.IsSuperAdmin {
|
|
1153
|
+
p.Affiliation = GroupAffiliationOwner
|
|
1154
|
+
} else if participant.IsAdmin {
|
|
1155
|
+
p.Affiliation = GroupAffiliationAdmin
|
|
1123
1156
|
}
|
|
1157
|
+
if IsAnonymousJID(p.JID) {
|
|
1158
|
+
if c, err := client.Store.Contacts.GetContact(ctx, participant.JID); err == nil {
|
|
1159
|
+
p.Nickname = c.PushName
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return p
|
|
1124
1163
|
}
|
|
1125
1164
|
|
|
1126
1165
|
// NewGroupEvent returns event data meant for [Session.propagateEvent] for the primive group event
|
|
1127
1166
|
// given. Group data returned by this function can be partial, and callers should take care to only
|
|
1128
1167
|
// handle non-empty values.
|
|
1129
|
-
func newGroupEvent(evt *events.GroupInfo) (EventKind, *EventPayload) {
|
|
1168
|
+
func newGroupEvent(ctx context.Context, client *whatsmeow.Client, evt *events.GroupInfo) (EventKind, *EventPayload) {
|
|
1130
1169
|
var group = Group{JID: evt.JID.ToNonAD().String()}
|
|
1131
1170
|
if evt.Name != nil {
|
|
1132
1171
|
group.Name = evt.Name.Name
|
|
1133
1172
|
}
|
|
1134
1173
|
if evt.Topic != nil {
|
|
1174
|
+
topicJID := getPreferredJID(ctx, client, evt.Topic.TopicSetBy, evt.Topic.TopicSetByPN)
|
|
1135
1175
|
group.Subject = GroupSubject{
|
|
1136
|
-
Subject:
|
|
1137
|
-
SetAt:
|
|
1138
|
-
|
|
1176
|
+
Subject: evt.Topic.Topic,
|
|
1177
|
+
SetAt: evt.Topic.TopicSetAt.Unix(),
|
|
1178
|
+
}
|
|
1179
|
+
if c, err := client.Store.Contacts.GetContact(ctx, topicJID); err == nil {
|
|
1180
|
+
group.Subject.SetBy = c.PushName
|
|
1139
1181
|
}
|
|
1140
1182
|
}
|
|
1141
1183
|
for _, p := range evt.Join {
|
|
@@ -1170,26 +1212,32 @@ func newGroupEvent(evt *events.GroupInfo) (EventKind, *EventPayload) {
|
|
|
1170
1212
|
// NewGroup returns a concrete [Group] for the primitive data given. This function will generally
|
|
1171
1213
|
// populate fields with as much data as is available from the remote, and is therefore should not
|
|
1172
1214
|
// be called when partial data is to be returned.
|
|
1173
|
-
func newGroup(client *whatsmeow.Client, info *types.GroupInfo) Group {
|
|
1215
|
+
func newGroup(ctx context.Context, client *whatsmeow.Client, info *types.GroupInfo) Group {
|
|
1174
1216
|
var participants []GroupParticipant
|
|
1175
1217
|
for i := range info.Participants {
|
|
1176
|
-
p := newGroupParticipant(info.Participants[i])
|
|
1218
|
+
p := newGroupParticipant(ctx, client, info.Participants[i])
|
|
1177
1219
|
if p.JID == "" {
|
|
1178
1220
|
continue
|
|
1179
1221
|
}
|
|
1180
1222
|
participants = append(participants, p)
|
|
1181
1223
|
}
|
|
1182
|
-
|
|
1224
|
+
|
|
1225
|
+
var topicJID = getPreferredJID(ctx, client, info.TopicSetBy, info.TopicSetByPN)
|
|
1226
|
+
var group = Group{
|
|
1183
1227
|
JID: info.JID.ToNonAD().String(),
|
|
1184
1228
|
Name: info.Name,
|
|
1185
1229
|
Subject: GroupSubject{
|
|
1186
|
-
Subject:
|
|
1187
|
-
SetAt:
|
|
1188
|
-
SetByJID: info.TopicSetBy.ToNonAD().String(),
|
|
1230
|
+
Subject: info.Topic,
|
|
1231
|
+
SetAt: info.TopicSetAt.Unix(),
|
|
1189
1232
|
},
|
|
1190
1233
|
Nickname: client.Store.PushName,
|
|
1191
1234
|
Participants: participants,
|
|
1192
1235
|
}
|
|
1236
|
+
if c, err := client.Store.Contacts.GetContact(ctx, topicJID); err == nil {
|
|
1237
|
+
group.Subject.SetBy = c.PushName
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
return group
|
|
1193
1241
|
}
|
|
1194
1242
|
|
|
1195
1243
|
// CallState represents the state of the call to synchronize with.
|
|
@@ -1234,3 +1282,25 @@ func newCallEvent(state CallState, meta types.BasicCallMeta) (EventKind, *EventP
|
|
|
1234
1282
|
Timestamp: meta.Timestamp.Unix(),
|
|
1235
1283
|
}}
|
|
1236
1284
|
}
|
|
1285
|
+
|
|
1286
|
+
// GetPreferredJID returns one of the [type.JID] values for the given senders, preferring the first
|
|
1287
|
+
// non-empty, non-hidden sender; if none are found, mappings from LID to JID are tried, or otherwise,
|
|
1288
|
+
// the first JID given is returned.
|
|
1289
|
+
func getPreferredJID(ctx context.Context, client *whatsmeow.Client, def types.JID, alt ...types.JID) types.JID {
|
|
1290
|
+
var jids = append([]types.JID{def}, alt...)
|
|
1291
|
+
for _, s := range jids {
|
|
1292
|
+
if !s.IsEmpty() && s.Server != types.HiddenUserServer {
|
|
1293
|
+
return s
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
for _, s := range jids {
|
|
1298
|
+
if !s.IsEmpty() && s.Server == types.HiddenUserServer {
|
|
1299
|
+
if p, err := client.Store.LIDs.GetPNForLID(ctx, s); err == nil {
|
|
1300
|
+
return p
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
return def
|
|
1306
|
+
}
|
slidge_whatsapp/gateway.go
CHANGED
|
@@ -3,9 +3,6 @@ package whatsapp
|
|
|
3
3
|
import (
|
|
4
4
|
// Standard library.
|
|
5
5
|
"context"
|
|
6
|
-
"fmt"
|
|
7
|
-
"log/slog"
|
|
8
|
-
"os"
|
|
9
6
|
"runtime"
|
|
10
7
|
|
|
11
8
|
// Internal packages.
|
|
@@ -40,6 +37,12 @@ func (d LinkedDevice) JID() types.JID {
|
|
|
40
37
|
return jid
|
|
41
38
|
}
|
|
42
39
|
|
|
40
|
+
// IsAnonymousJID returns true if the JID given is not addressible, that is, if it's actually a LID.
|
|
41
|
+
func IsAnonymousJID(id string) bool {
|
|
42
|
+
jid, _ := types.ParseJID(id)
|
|
43
|
+
return jid.Server == types.HiddenUserServer
|
|
44
|
+
}
|
|
45
|
+
|
|
43
46
|
// A Gateway represents a persistent process for establishing individual sessions between linked
|
|
44
47
|
// devices and WhatsApp.
|
|
45
48
|
type Gateway struct {
|
|
@@ -63,13 +66,7 @@ func NewGateway() *Gateway {
|
|
|
63
66
|
// Init performs initialization procedures for the Gateway, and is expected to be run before any
|
|
64
67
|
// calls to [Gateway.Session].
|
|
65
68
|
func (w *Gateway) Init() error {
|
|
66
|
-
w.logger =
|
|
67
|
-
module: "Slidge",
|
|
68
|
-
logger: slog.New(
|
|
69
|
-
slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: logLevel(w.LogLevel)}),
|
|
70
|
-
),
|
|
71
|
-
}
|
|
72
|
-
|
|
69
|
+
w.logger = walog.Stdout("slidge", w.LogLevel, false)
|
|
73
70
|
container, err := sqlstore.New(context.Background(), "sqlite3", w.DBPath, w.logger)
|
|
74
71
|
if err != nil {
|
|
75
72
|
return err
|
|
@@ -130,56 +127,3 @@ func (w *Gateway) CleanupSession(device LinkedDevice) error {
|
|
|
130
127
|
|
|
131
128
|
return nil
|
|
132
129
|
}
|
|
133
|
-
|
|
134
|
-
// A LogLevel represents a mapping between Python standard logging levels and Go standard logging
|
|
135
|
-
// levels.
|
|
136
|
-
type logLevel string
|
|
137
|
-
|
|
138
|
-
var _ slog.Leveler = logLevel("")
|
|
139
|
-
|
|
140
|
-
// Level returns the Go equivalent logging level for the Python logging level represented.
|
|
141
|
-
func (l logLevel) Level() slog.Level {
|
|
142
|
-
switch l {
|
|
143
|
-
case "FATAL", "CRITICAL", "ERROR":
|
|
144
|
-
return slog.LevelError
|
|
145
|
-
case "WARN", "WARNING":
|
|
146
|
-
return slog.LevelWarn
|
|
147
|
-
case "DEBUG":
|
|
148
|
-
return slog.LevelDebug
|
|
149
|
-
default:
|
|
150
|
-
return slog.LevelInfo
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// A Logger represents a mapping between a WhatsMeow logger and Go standard logging functions.
|
|
155
|
-
type logger struct {
|
|
156
|
-
module string
|
|
157
|
-
logger *slog.Logger
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
var _ walog.Logger = logger{}
|
|
161
|
-
|
|
162
|
-
// Errorf handles the given message as representing a (typically) fatal error.
|
|
163
|
-
func (l logger) Errorf(msg string, args ...any) {
|
|
164
|
-
l.logger.Error(fmt.Sprintf(msg, args...))
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
// Warn handles the given message as representing a non-fatal error or warning thereof.
|
|
168
|
-
func (l logger) Warnf(msg string, args ...any) {
|
|
169
|
-
l.logger.Warn(fmt.Sprintf(msg, args...))
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Infof handles the given message as representing an informational notice.
|
|
173
|
-
func (l logger) Infof(msg string, args ...any) {
|
|
174
|
-
l.logger.Info(fmt.Sprintf(msg, args...))
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Debugf handles the given message as representing an internal-only debug message.
|
|
178
|
-
func (l logger) Debugf(msg string, args ...any) {
|
|
179
|
-
l.logger.Debug(fmt.Sprintf(msg, args...))
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
// Sub is a no-op and will return the receiver itself.
|
|
183
|
-
func (l logger) Sub(module string) walog.Logger {
|
|
184
|
-
return logger{logger: l.logger.With(slog.String("module", l.module+"."+module))}
|
|
185
|
-
}
|
slidge_whatsapp/gateway.py
CHANGED
|
@@ -2,7 +2,7 @@ from logging import getLevelName, getLogger
|
|
|
2
2
|
from pathlib import Path
|
|
3
3
|
from typing import TYPE_CHECKING
|
|
4
4
|
|
|
5
|
-
from slidge import BaseGateway, FormField,
|
|
5
|
+
from slidge import BaseGateway, FormField, global_config
|
|
6
6
|
|
|
7
7
|
from . import config
|
|
8
8
|
from .generated import whatsapp
|
|
@@ -62,13 +62,12 @@ class Gateway(BaseGateway):
|
|
|
62
62
|
"""
|
|
63
63
|
pass
|
|
64
64
|
|
|
65
|
-
async def unregister(self,
|
|
65
|
+
async def unregister(self, session: "Session"): # type:ignore[override]
|
|
66
66
|
"""
|
|
67
67
|
Logout from the active WhatsApp session. This will also force a remote log-out, and thus
|
|
68
68
|
require pairing on next login. For simply disconnecting the active session, look at the
|
|
69
69
|
:meth:`.Session.disconnect` function.
|
|
70
70
|
"""
|
|
71
|
-
session: "Session" = self.get_session_from_user(user) # type:ignore
|
|
72
71
|
session.whatsapp.Logout()
|
|
73
72
|
try:
|
|
74
73
|
device_id = session.user.legacy_module_data["device_id"]
|