slidge-whatsapp 0.3.0b0__cp313-cp313-manylinux_2_36_aarch64.whl → 0.3.4__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 +2 -0
- slidge_whatsapp/event.go +72 -22
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.h +206 -206
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +166 -166
- slidge_whatsapp/generated/go.py +1 -1
- slidge_whatsapp/generated/whatsapp.c +1557 -1557
- slidge_whatsapp/generated/whatsapp.go +1227 -1227
- slidge_whatsapp/generated/whatsapp.py +1382 -1382
- slidge_whatsapp/generated/whatsapp_go.h +206 -206
- slidge_whatsapp/go.mod +11 -11
- slidge_whatsapp/go.sum +26 -26
- slidge_whatsapp/session.go +4 -4
- slidge_whatsapp/vendor/github.com/ebitengine/purego/README.md +21 -5
- slidge_whatsapp/vendor/github.com/ebitengine/purego/abi_loong64.h +60 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/cgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlerror.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_netbsd.go +15 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_nocgo_netbsd.go +9 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_stubs.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/func.go +113 -60
- slidge_whatsapp/vendor/github.com/ebitengine/purego/gen.go +6 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/go_runtime.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go +2 -2
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go +2 -2
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h +60 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s +40 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_loong64.go +92 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go +106 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go +4 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go +4 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go +4 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go +26 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go +23 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +11 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go +1 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go +1 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go +1 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_netbsd.go +30 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s +71 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s +5 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/nocgo.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_amd64.go +8 -4
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_arm64.go +16 -6
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_loong64.go +190 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_other.go +6 -2
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_amd64.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_arm64.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_loong64.s +96 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_arm64.s +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_loong64.s +75 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall.go +6 -3
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go +3 -3
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_sysv.go +13 -10
- slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_windows.go +1 -1
- slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_amd64.s +2002 -2002
- slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_arm64.s +4002 -4002
- slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_loong64.s +4014 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/session/SessionCipher.go +7 -2
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/log.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/module.go +119 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgradetable.go +3 -34
- slidge_whatsapp/vendor/go.mau.fi/util/exbytes/string.go +20 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exbytes/writer.go +78 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/cast.go +42 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/chunk.go +28 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/deduplicate.go +67 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exslices/diff.go +63 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +15 -1
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncmap.go +48 -7
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncset.go +13 -0
- slidge_whatsapp/vendor/go.mau.fi/util/jsontime/helpers.go +16 -5
- slidge_whatsapp/vendor/go.mau.fi/util/jsontime/integer.go +27 -12
- slidge_whatsapp/vendor/go.mau.fi/util/random/string.go +47 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +60 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +20 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +6 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +63 -42
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +31 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +77 -26
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +23 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +5 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +22 -23
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +21 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.pb.go +7747 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/{waBotMetadata/WABotMetadata.proto → waAICommon/WAAICommon.proto} +269 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +128 -14
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8953 -10087
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +216 -330
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +11 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +226 -83
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +709 -449
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +24 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +78 -24
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +6 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +528 -267
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +24 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +47 -14
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/request.go +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +6 -13
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +130 -62
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +33 -32
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +16 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sessioncache.go +125 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/signal.go +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/lidmap.go +82 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +135 -55
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +8 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/11-redacted-phone-contacts.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +24 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +6 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +24 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +7 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +43 -3
- slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +7 -4
- slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +11 -6
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go125.go +15 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go126.go +15 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +24 -1
- slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +0 -1
- slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +35 -26
- slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +4 -2
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched.go +2 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/{writesched_priority.go → writesched_priority_rfc7540.go} +52 -52
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_priority_rfc9128.go +209 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_roundrobin.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/request.go +2 -2
- slidge_whatsapp/vendor/golang.org/x/net/internal/socks/socks.go +1 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +9 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/fdset.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/ifreq_linux.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/mkall.sh +1 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +1 -3
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_netbsd.go +17 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +2 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +18 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/core.go +2 -9
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +35 -17
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +14 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +20 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
- slidge_whatsapp/vendor/modules.txt +15 -13
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/METADATA +4 -3
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/RECORD +166 -138
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/WHEEL +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +0 -5156
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/entry_points.txt +0 -0
- {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info/licenses}/LICENSE +0 -0
slidge_whatsapp/contact.py
CHANGED
|
@@ -77,6 +77,8 @@ class Roster(LegacyRoster[str, Contact]):
|
|
|
77
77
|
return contact
|
|
78
78
|
|
|
79
79
|
async def legacy_id_to_jid_username(self, legacy_id: str) -> str:
|
|
80
|
+
if not "@" in legacy_id:
|
|
81
|
+
raise XMPPError("item-not-found", "Invalid contact ID, not a JID")
|
|
80
82
|
return "+" + legacy_id[: legacy_id.find("@")]
|
|
81
83
|
|
|
82
84
|
async def jid_username_to_legacy_id(self, jid_username: str) -> str:
|
slidge_whatsapp/event.go
CHANGED
|
@@ -142,6 +142,10 @@ type Presence struct {
|
|
|
142
142
|
// NewPresenceEvent returns event data meant for [Session.propagateEvent] for the primitive presence
|
|
143
143
|
// event given.
|
|
144
144
|
func newPresenceEvent(evt *events.Presence) (EventKind, *EventPayload) {
|
|
145
|
+
if evt.From.Server == types.HiddenUserServer {
|
|
146
|
+
return EventUnknown, nil
|
|
147
|
+
}
|
|
148
|
+
|
|
145
149
|
var presence = Presence{
|
|
146
150
|
JID: evt.From.ToNonAD().String(),
|
|
147
151
|
Kind: PresenceAvailable,
|
|
@@ -388,7 +392,7 @@ func newMessageEvent(ctx context.Context, client *whatsmeow.Client, evt *events.
|
|
|
388
392
|
message.Attachments = append(message.Attachments, attach...)
|
|
389
393
|
message.Kind = MessageAttachment
|
|
390
394
|
if context != nil {
|
|
391
|
-
message = getMessageWithContext(message, context)
|
|
395
|
+
message = getMessageWithContext(ctx, client, message, context)
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
398
|
|
|
@@ -409,7 +413,7 @@ func newMessageEvent(ctx context.Context, client *whatsmeow.Client, evt *events.
|
|
|
409
413
|
message.GroupInvite = newGroup(ctx, client, info)
|
|
410
414
|
}
|
|
411
415
|
} else {
|
|
412
|
-
message = getMessageWithContext(message, e.GetContextInfo())
|
|
416
|
+
message = getMessageWithContext(ctx, client, message, e.GetContextInfo())
|
|
413
417
|
}
|
|
414
418
|
}
|
|
415
419
|
|
|
@@ -424,15 +428,21 @@ func newMessageEvent(ctx context.Context, client *whatsmeow.Client, evt *events.
|
|
|
424
428
|
// GetMessageWithContext processes the given [Message] and applies any context metadata might be
|
|
425
429
|
// useful; examples of context include messages being quoted. If no context is found, the original
|
|
426
430
|
// message is returned unchanged.
|
|
427
|
-
func getMessageWithContext(message Message, info *waE2E.ContextInfo) Message {
|
|
431
|
+
func getMessageWithContext(ctx context.Context, client *whatsmeow.Client, message Message, info *waE2E.ContextInfo) Message {
|
|
428
432
|
if info == nil {
|
|
429
433
|
return message
|
|
430
434
|
}
|
|
431
435
|
|
|
436
|
+
originJID, err := types.ParseJID(info.GetParticipant())
|
|
437
|
+
if err != nil {
|
|
438
|
+
return message
|
|
439
|
+
}
|
|
440
|
+
|
|
432
441
|
message.ReplyID = info.GetStanzaID()
|
|
433
|
-
message.OriginJID =
|
|
442
|
+
message.OriginJID = getPreferredJID(ctx, client, originJID).ToNonAD().String()
|
|
434
443
|
message.IsForwarded = info.GetIsForwarded()
|
|
435
444
|
|
|
445
|
+
// Handle reply messages.
|
|
436
446
|
if q := info.GetQuotedMessage(); q != nil {
|
|
437
447
|
if qe := q.GetExtendedTextMessage(); qe != nil {
|
|
438
448
|
message.ReplyBody = qe.GetText()
|
|
@@ -441,6 +451,23 @@ func getMessageWithContext(message Message, info *waE2E.ContextInfo) Message {
|
|
|
441
451
|
}
|
|
442
452
|
}
|
|
443
453
|
|
|
454
|
+
// Replace LIDs with JIDs in message mentions, if possible.
|
|
455
|
+
if m := info.GetMentionedJID(); len(m) > 0 {
|
|
456
|
+
for i := range m {
|
|
457
|
+
mentionLID, err := types.ParseJID(m[i])
|
|
458
|
+
if err != nil || mentionLID.Server != types.HiddenUserServer {
|
|
459
|
+
continue
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
mentionJID := getPreferredJID(ctx, client, mentionLID)
|
|
463
|
+
if mentionLID == mentionJID {
|
|
464
|
+
continue
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
message.Body = strings.ReplaceAll(message.Body, "@"+mentionLID.User, "@"+mentionJID.User)
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
|
|
444
471
|
return message
|
|
445
472
|
}
|
|
446
473
|
|
|
@@ -891,7 +918,11 @@ func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *wa
|
|
|
891
918
|
}
|
|
892
919
|
|
|
893
920
|
if info.Participant != nil {
|
|
894
|
-
|
|
921
|
+
jid, err := types.ParseJID(info.GetParticipant())
|
|
922
|
+
if err != nil {
|
|
923
|
+
return EventUnknown, nil
|
|
924
|
+
}
|
|
925
|
+
message.JID = getPreferredJID(ctx, client, jid).ToNonAD().String()
|
|
895
926
|
} else if info.GetKey().GetFromMe() {
|
|
896
927
|
message.JID = client.Store.ID.ToNonAD().String()
|
|
897
928
|
} else {
|
|
@@ -906,9 +937,13 @@ func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *wa
|
|
|
906
937
|
case waWeb.WebMessageInfo_CIPHERTEXT:
|
|
907
938
|
return EventUnknown, nil
|
|
908
939
|
case waWeb.WebMessageInfo_CALL_MISSED_VOICE, waWeb.WebMessageInfo_CALL_MISSED_VIDEO:
|
|
940
|
+
jid, err := types.ParseJID(info.GetKey().GetParticipant())
|
|
941
|
+
if err != nil {
|
|
942
|
+
return EventUnknown, nil
|
|
943
|
+
}
|
|
909
944
|
return EventCall, &EventPayload{Call: Call{
|
|
910
945
|
State: CallMissed,
|
|
911
|
-
JID:
|
|
946
|
+
JID: getPreferredJID(ctx, client, jid).ToNonAD().String(),
|
|
912
947
|
Timestamp: int64(info.GetMessageTimestamp()),
|
|
913
948
|
}}
|
|
914
949
|
case waWeb.WebMessageInfo_REVOKE:
|
|
@@ -924,10 +959,14 @@ func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *wa
|
|
|
924
959
|
// Handle emoji reaction to existing message.
|
|
925
960
|
for _, r := range info.GetReactions() {
|
|
926
961
|
if r.GetText() != "" {
|
|
962
|
+
jid, err := types.ParseJID(r.GetKey().GetParticipant())
|
|
963
|
+
if err != nil {
|
|
964
|
+
continue
|
|
965
|
+
}
|
|
927
966
|
message.Reactions = append(message.Reactions, Message{
|
|
928
967
|
Kind: MessageReaction,
|
|
929
968
|
ID: r.GetKey().GetID(),
|
|
930
|
-
JID:
|
|
969
|
+
JID: getPreferredJID(ctx, client, jid).ToNonAD().String(),
|
|
931
970
|
Body: r.GetText(),
|
|
932
971
|
Timestamp: r.GetSenderTimestampMS() / 1000,
|
|
933
972
|
IsCarbon: r.GetKey().GetFromMe(),
|
|
@@ -943,7 +982,7 @@ func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *wa
|
|
|
943
982
|
message.Attachments = append(message.Attachments, attach...)
|
|
944
983
|
message.Kind = MessageAttachment
|
|
945
984
|
if context != nil {
|
|
946
|
-
message = getMessageWithContext(message, context)
|
|
985
|
+
message = getMessageWithContext(ctx, client, message, context)
|
|
947
986
|
}
|
|
948
987
|
}
|
|
949
988
|
|
|
@@ -953,7 +992,15 @@ func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *wa
|
|
|
953
992
|
if client.Store.ID.ToNonAD().String() == r.GetUserJID() {
|
|
954
993
|
continue
|
|
955
994
|
}
|
|
956
|
-
|
|
995
|
+
jid, err := types.ParseJID(r.GetUserJID())
|
|
996
|
+
if err != nil {
|
|
997
|
+
continue
|
|
998
|
+
}
|
|
999
|
+
var receipt = Receipt{
|
|
1000
|
+
JID: getPreferredJID(ctx, client, jid).ToNonAD().String(),
|
|
1001
|
+
GroupJID: message.GroupJID,
|
|
1002
|
+
MessageIDs: []string{message.ID},
|
|
1003
|
+
}
|
|
957
1004
|
switch info.GetStatus() {
|
|
958
1005
|
case waWeb.WebMessageInfo_DELIVERY_ACK:
|
|
959
1006
|
receipt.Kind = ReceiptDelivered
|
|
@@ -971,8 +1018,7 @@ func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *wa
|
|
|
971
1018
|
if message.Body == "" {
|
|
972
1019
|
message.Body = e.GetText()
|
|
973
1020
|
}
|
|
974
|
-
|
|
975
|
-
message = getMessageWithContext(message, e.GetContextInfo())
|
|
1021
|
+
message = getMessageWithContext(ctx, client, message, e.GetContextInfo())
|
|
976
1022
|
}
|
|
977
1023
|
|
|
978
1024
|
// Ignore obviously invalid messages.
|
|
@@ -1004,8 +1050,10 @@ type ChatState struct {
|
|
|
1004
1050
|
|
|
1005
1051
|
// NewChatStateEvent returns event data meant for [Session.propagateEvent] for the primitive
|
|
1006
1052
|
// chat-state event given.
|
|
1007
|
-
func newChatStateEvent(evt *events.ChatPresence) (EventKind, *EventPayload) {
|
|
1008
|
-
var state = ChatState{
|
|
1053
|
+
func newChatStateEvent(ctx context.Context, client *whatsmeow.Client, evt *events.ChatPresence) (EventKind, *EventPayload) {
|
|
1054
|
+
var state = ChatState{
|
|
1055
|
+
JID: getPreferredJID(ctx, client, evt.Sender, evt.SenderAlt).ToNonAD().String(),
|
|
1056
|
+
}
|
|
1009
1057
|
if evt.IsGroup {
|
|
1010
1058
|
state.GroupJID = evt.Chat.ToNonAD().String()
|
|
1011
1059
|
}
|
|
@@ -1146,8 +1194,9 @@ func newGroupParticipant(ctx context.Context, client *whatsmeow.Client, particip
|
|
|
1146
1194
|
if participant.Error > 0 {
|
|
1147
1195
|
return GroupParticipant{}
|
|
1148
1196
|
}
|
|
1197
|
+
var jid = getPreferredJID(ctx, client, participant.JID, participant.PhoneNumber)
|
|
1149
1198
|
var p = GroupParticipant{
|
|
1150
|
-
JID:
|
|
1199
|
+
JID: jid.ToNonAD().String(),
|
|
1151
1200
|
}
|
|
1152
1201
|
if participant.IsSuperAdmin {
|
|
1153
1202
|
p.Affiliation = GroupAffiliationOwner
|
|
@@ -1182,26 +1231,26 @@ func newGroupEvent(ctx context.Context, client *whatsmeow.Client, evt *events.Gr
|
|
|
1182
1231
|
}
|
|
1183
1232
|
for _, p := range evt.Join {
|
|
1184
1233
|
group.Participants = append(group.Participants, GroupParticipant{
|
|
1185
|
-
JID: p.ToNonAD().String(),
|
|
1234
|
+
JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
|
|
1186
1235
|
Action: GroupParticipantActionAdd,
|
|
1187
1236
|
})
|
|
1188
1237
|
}
|
|
1189
1238
|
for _, p := range evt.Leave {
|
|
1190
1239
|
group.Participants = append(group.Participants, GroupParticipant{
|
|
1191
|
-
JID: p.ToNonAD().String(),
|
|
1240
|
+
JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
|
|
1192
1241
|
Action: GroupParticipantActionRemove,
|
|
1193
1242
|
})
|
|
1194
1243
|
}
|
|
1195
1244
|
for _, p := range evt.Promote {
|
|
1196
1245
|
group.Participants = append(group.Participants, GroupParticipant{
|
|
1197
|
-
JID: p.ToNonAD().String(),
|
|
1246
|
+
JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
|
|
1198
1247
|
Action: GroupParticipantActionPromote,
|
|
1199
1248
|
Affiliation: GroupAffiliationAdmin,
|
|
1200
1249
|
})
|
|
1201
1250
|
}
|
|
1202
1251
|
for _, p := range evt.Demote {
|
|
1203
1252
|
group.Participants = append(group.Participants, GroupParticipant{
|
|
1204
|
-
JID: p.ToNonAD().String(),
|
|
1253
|
+
JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
|
|
1205
1254
|
Action: GroupParticipantActionDemote,
|
|
1206
1255
|
Affiliation: GroupAffiliationNone,
|
|
1207
1256
|
})
|
|
@@ -1271,14 +1320,15 @@ type Call struct {
|
|
|
1271
1320
|
}
|
|
1272
1321
|
|
|
1273
1322
|
// NewCallEvent returns event data meant for [Session.propagateEvent] for the call metadata given.
|
|
1274
|
-
func newCallEvent(state CallState, meta types.BasicCallMeta) (EventKind, *EventPayload) {
|
|
1275
|
-
if state == CallUnknown
|
|
1323
|
+
func newCallEvent(ctx context.Context, client *whatsmeow.Client, state CallState, meta types.BasicCallMeta) (EventKind, *EventPayload) {
|
|
1324
|
+
if state == CallUnknown {
|
|
1276
1325
|
return EventUnknown, nil
|
|
1277
1326
|
}
|
|
1278
1327
|
|
|
1328
|
+
jid := getPreferredJID(ctx, client, meta.From, meta.CallCreator, meta.CallCreatorAlt)
|
|
1279
1329
|
return EventCall, &EventPayload{Call: Call{
|
|
1280
1330
|
State: state,
|
|
1281
|
-
JID:
|
|
1331
|
+
JID: jid.ToNonAD().String(),
|
|
1282
1332
|
Timestamp: meta.Timestamp.Unix(),
|
|
1283
1333
|
}}
|
|
1284
1334
|
}
|
|
@@ -1296,7 +1346,7 @@ func getPreferredJID(ctx context.Context, client *whatsmeow.Client, def types.JI
|
|
|
1296
1346
|
|
|
1297
1347
|
for _, s := range jids {
|
|
1298
1348
|
if !s.IsEmpty() && s.Server == types.HiddenUserServer {
|
|
1299
|
-
if p,
|
|
1349
|
+
if p, _ := client.Store.LIDs.GetPNForLID(ctx, s); !p.IsEmpty() {
|
|
1300
1350
|
return p
|
|
1301
1351
|
}
|
|
1302
1352
|
}
|