slidge-whatsapp 0.2.7__cp312-cp312-manylinux_2_36_aarch64.whl → 0.3.0b0__cp312-cp312-manylinux_2_36_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (212) hide show
  1. slidge_whatsapp/contact.py +13 -3
  2. slidge_whatsapp/event.go +107 -37
  3. slidge_whatsapp/gateway.go +7 -63
  4. slidge_whatsapp/gateway.py +2 -3
  5. slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.h +186 -169
  6. slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.so +0 -0
  7. slidge_whatsapp/generated/build.py +148 -134
  8. slidge_whatsapp/generated/whatsapp.c +1652 -1380
  9. slidge_whatsapp/generated/whatsapp.go +798 -687
  10. slidge_whatsapp/generated/whatsapp.py +1169 -1044
  11. slidge_whatsapp/generated/whatsapp_go.h +186 -169
  12. slidge_whatsapp/go.mod +18 -15
  13. slidge_whatsapp/go.sum +38 -26
  14. slidge_whatsapp/group.py +34 -30
  15. slidge_whatsapp/media/media.go +1 -1
  16. slidge_whatsapp/session.go +33 -16
  17. slidge_whatsapp/session.py +46 -14
  18. slidge_whatsapp/vendor/github.com/beeper/argo-go/LICENSE +9 -0
  19. slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockreader.go +329 -0
  20. slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockwriter.go +417 -0
  21. slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/decoder.go +652 -0
  22. slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/encoder.go +985 -0
  23. slidge_whatsapp/vendor/github.com/beeper/argo-go/header/header.go +135 -0
  24. slidge_whatsapp/vendor/github.com/beeper/argo-go/internal/util/util.go +133 -0
  25. slidge_whatsapp/vendor/github.com/beeper/argo-go/label/label.go +384 -0
  26. slidge_whatsapp/vendor/github.com/beeper/argo-go/label/wiremarkers.go +37 -0
  27. slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/bitset/bitset.go +197 -0
  28. slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/buf/buf.go +420 -0
  29. slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/varint/varint.go +246 -0
  30. slidge_whatsapp/vendor/github.com/beeper/argo-go/wire/wire.go +614 -0
  31. slidge_whatsapp/vendor/github.com/beeper/argo-go/wirecodec/decode.go +341 -0
  32. slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/LICENSE +21 -0
  33. slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/list.go +95 -0
  34. slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/orderedmap.go +187 -0
  35. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz.go +1 -0
  36. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_cgo.go +3 -0
  37. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_nocgo.go +4 -5
  38. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_darwin.go +11 -1
  39. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_linux.go +10 -0
  40. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_windows.go +12 -0
  41. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/.gitignore +0 -2
  42. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/CHANGELOG.md +30 -0
  43. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/COPYRIGHT.txt +6 -1
  44. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/README.md +14 -17
  45. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi.go +1 -1
  46. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi2.go +7 -0
  47. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/LICENSE +21 -0
  48. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_amd64/libffi.8.dylib +0 -0
  49. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_arm64/libffi.8.dylib +0 -0
  50. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/windows_amd64/libffi-8.dll +0 -0
  51. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif.go +15 -0
  52. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif_arm64.go +16 -0
  53. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed.go +49 -0
  54. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_amd64.go +10 -0
  55. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_arm64.go +10 -0
  56. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_windows_amd64.go +10 -0
  57. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/ffi.go +51 -13
  58. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/init.go +22 -9
  59. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/README.md +2 -0
  60. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +3096 -1651
  61. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +188 -128
  62. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go +13 -140
  63. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3ext.h +4 -0
  64. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.23.go +2 -2
  65. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.25.go +37 -0
  66. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/LICENSE +19 -0
  67. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go +37 -0
  68. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/collections.go +148 -0
  69. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/comment.go +31 -0
  70. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/decode.go +216 -0
  71. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/definition.go +110 -0
  72. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +43 -0
  73. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/document.go +89 -0
  74. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go +159 -0
  75. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go +41 -0
  76. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/operation.go +32 -0
  77. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/path.go +72 -0
  78. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +41 -0
  79. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/source.go +19 -0
  80. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/type.go +68 -0
  81. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/value.go +122 -0
  82. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/handleerrors.go +60 -26
  83. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/networkerror.go +2 -1
  84. slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +28 -0
  85. slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +19 -3
  86. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/.pre-commit-config.yaml +3 -3
  87. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -1
  88. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -1
  89. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +5 -1
  90. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo-wire-type-store.argo +63 -0
  91. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo.go +62 -0
  92. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/name-to-queryids.json +306 -0
  93. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +3 -2
  94. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +1 -0
  95. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +15 -18
  96. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +5 -0
  97. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +4 -0
  98. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +3 -0
  99. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +97 -25
  100. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +22 -10
  101. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +10 -9
  102. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +2 -14
  103. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/newsletter.go +83 -7
  104. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +5 -1
  105. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +2 -2
  106. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +15 -6
  107. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +5156 -0
  108. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.proto +516 -0
  109. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.pb.go +30 -3
  110. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.proto +3 -0
  111. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8532 -11526
  112. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +132 -438
  113. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +52 -23
  114. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +3 -0
  115. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +225 -73
  116. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +21 -5
  117. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +884 -441
  118. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +40 -0
  119. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +60 -38
  120. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +3 -0
  121. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +8 -1
  122. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +6 -4
  123. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
  124. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +3 -2
  125. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +25 -5
  126. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +3 -1
  127. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +1 -0
  128. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +8 -0
  129. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +2 -1
  130. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +2 -0
  131. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +12 -8
  132. slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +1 -1
  133. slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +44 -2
  134. slidge_whatsapp/vendor/golang.org/x/net/http2/gotrack.go +14 -3
  135. slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +7 -29
  136. slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +53 -71
  137. slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +20 -74
  138. slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +1 -3
  139. slidge_whatsapp/vendor/golang.org/x/sys/unix/mkerrors.sh +3 -0
  140. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_darwin.go +1 -55
  141. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_solaris.go +1 -1
  142. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux.go +47 -16
  143. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +3 -0
  144. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +3 -0
  145. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +3 -0
  146. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +3 -0
  147. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +3 -0
  148. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +3 -0
  149. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +3 -0
  150. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +3 -0
  151. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +3 -0
  152. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +3 -0
  153. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +3 -0
  154. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +3 -0
  155. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +3 -0
  156. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +3 -0
  157. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +3 -0
  158. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +4 -4
  159. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +1 -0
  160. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +1 -0
  161. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +1 -0
  162. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +1 -0
  163. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +1 -0
  164. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +1 -0
  165. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +1 -0
  166. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +1 -0
  167. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +1 -0
  168. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +1 -0
  169. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +1 -0
  170. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +1 -0
  171. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +1 -0
  172. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +1 -0
  173. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +1 -0
  174. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux.go +168 -12
  175. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +17 -1
  176. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +16 -0
  177. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +18 -2
  178. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +16 -0
  179. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +16 -0
  180. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +17 -1
  181. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +16 -0
  182. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +16 -0
  183. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +17 -1
  184. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +18 -2
  185. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +16 -0
  186. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +16 -0
  187. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +16 -0
  188. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +16 -0
  189. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +16 -0
  190. slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +6 -0
  191. slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +483 -483
  192. slidge_whatsapp/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +25 -1
  193. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +0 -0
  194. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +10 -5
  195. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/presence.go +33 -0
  196. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +6 -0
  197. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +68 -22
  198. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go +2 -1
  199. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go +8 -37
  200. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/presence.go +0 -3
  201. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
  202. slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +8 -0
  203. slidge_whatsapp/vendor/modules.txt +43 -23
  204. {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/METADATA +2 -2
  205. {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/RECORD +208 -161
  206. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi_amd64.go +0 -7
  207. slidge_whatsapp/vendor/golang.org/x/net/http2/config_go124.go +0 -61
  208. slidge_whatsapp/vendor/golang.org/x/net/http2/config_pre_go124.go +0 -16
  209. slidge_whatsapp/vendor/golang.org/x/net/http2/timer.go +0 -20
  210. {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/LICENSE +0 -0
  211. {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/WHEEL +0 -0
  212. {slidge_whatsapp-0.2.7.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/entry_points.txt +0 -0
slidge_whatsapp/group.py CHANGED
@@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, AsyncIterator, Optional
4
4
 
5
5
  from slidge.group import LegacyBookmarks, LegacyMUC, LegacyParticipant, MucType
6
6
  from slidge.util.archive_msg import HistoryMessage
7
- from slidge.util.types import Hat, HoleBound, Mention, MucAffiliation
7
+ from slidge.util.types import Avatar, Hat, HoleBound, Mention, MucAffiliation
8
8
  from slixmpp.exceptions import XMPPError
9
9
 
10
10
  from .generated import go, whatsapp
@@ -28,9 +28,12 @@ class MUC(LegacyMUC[str, str, Participant, str]):
28
28
 
29
29
  async def update_info(self):
30
30
  try:
31
- avatar = self.session.whatsapp.GetAvatar(self.legacy_id, self.avatar or "")
32
- if avatar.URL and self.avatar != avatar.ID:
33
- await self.set_avatar(avatar.URL, avatar.ID)
31
+ unique_id = ""
32
+ if self.avatar is not None:
33
+ unique_id = self.avatar.unique_id or "" # type:ignore[assignment]
34
+ avatar = self.session.whatsapp.GetAvatar(self.legacy_id, unique_id)
35
+ if avatar.URL and unique_id != avatar.ID:
36
+ await self.set_avatar(Avatar(url=avatar.URL, unique_id=avatar.ID))
34
37
  elif avatar.URL == "" and avatar.ID == "":
35
38
  await self.set_avatar(None)
36
39
  except RuntimeError as err:
@@ -60,9 +63,16 @@ class MUC(LegacyMUC[str, str, Participant, str]):
60
63
  self.session.whatsapp.RequestMessageHistory(self.legacy_id, oldest_message)
61
64
 
62
65
  def get_message_sender(self, legacy_msg_id: str):
63
- assert self.pk is not None
64
- stored = self.xmpp.store.mam.get_by_legacy_id(self.pk, legacy_msg_id)
65
- if stored is None:
66
+ with self.xmpp.store.session() as orm:
67
+ try:
68
+ stored = next(
69
+ self.xmpp.store.mam.get_messages(
70
+ orm, self.stored.id, ids=[legacy_msg_id]
71
+ )
72
+ )
73
+ except StopIteration:
74
+ stored = None
75
+ if not stored:
66
76
  raise XMPPError("internal-server-error", "Unable to find message sender")
67
77
  msg = HistoryMessage(stored.stanza)
68
78
  occupant_id = msg.stanza["occupant-id"]["id"]
@@ -87,17 +97,13 @@ class MUC(LegacyMUC[str, str, Participant, str]):
87
97
  if info.Subject.SetAt:
88
98
  set_at = datetime.fromtimestamp(info.Subject.SetAt, tz=timezone.utc)
89
99
  self.subject_date = set_at
90
- if info.Subject.SetByJID:
91
- participant = await self.get_participant_by_legacy_id(
92
- info.Subject.SetByJID
93
- )
94
- if name := participant.nickname:
95
- self.subject_setter = name
100
+ if info.Subject.SetBy:
101
+ self.subject_setter = info.Subject.SetBy
96
102
  self.session.whatsapp_participants[self.legacy_id] = info.Participants
97
103
  self.n_participants = len(info.Participants)
98
104
  # Since whatsmeow does always emit a whatsapp.Group event even for participant changes,
99
105
  # we need to do that to actually update the participant list.
100
- if self._participants_filled:
106
+ if self.participants_filled:
101
107
  async for _ in self.fill_participants():
102
108
  pass
103
109
 
@@ -109,7 +115,12 @@ class MUC(LegacyMUC[str, str, Participant, str]):
109
115
  self.log.warning("No participants!")
110
116
  return
111
117
  for data in participants:
112
- participant = await self.get_participant_by_legacy_id(data.JID)
118
+ if whatsapp.IsAnonymousJID(data.JID):
119
+ participant = await self.get_participant(data.JID)
120
+ if data.Nickname:
121
+ participant.nickname = data.Nickname
122
+ else:
123
+ participant = await self.get_participant_by_legacy_id(data.JID)
113
124
  if data.Action == whatsapp.GroupParticipantActionRemove:
114
125
  self.remove_participant(participant)
115
126
  else:
@@ -135,7 +146,7 @@ class MUC(LegacyMUC[str, str, Participant, str]):
135
146
  t,
136
147
  participants=(
137
148
  {
138
- p.contact.jid_username: p.nickname
149
+ p.contact.jid.username: p.nickname
139
150
  async for p in self.get_participants()
140
151
  if p.contact is not None # should not happen
141
152
  }
@@ -171,16 +182,14 @@ class MUC(LegacyMUC[str, str, Participant, str]):
171
182
  reason: Optional[str],
172
183
  nickname: Optional[str],
173
184
  ):
174
- assert contact.contact_pk is not None
175
- assert self.pk is not None
176
185
  if affiliation == "member":
177
- if (
178
- self.xmpp.store.participants.get_by_contact(self.pk, contact.contact_pk)
179
- is not None
180
- ):
181
- action = whatsapp.GroupParticipantActionDemote
182
- else:
186
+ participant = await self.get_participant_by_contact(contact, create=False)
187
+ if participant is None or participant.affiliation in ("outcast", "none"):
183
188
  action = whatsapp.GroupParticipantActionAdd
189
+ elif participant.affiliation == "member":
190
+ return
191
+ else:
192
+ action = whatsapp.GroupParticipantActionDemote
184
193
  elif affiliation == "admin":
185
194
  action = whatsapp.GroupParticipantActionPromote
186
195
  elif affiliation == "outcast" or affiliation == "none":
@@ -232,12 +241,7 @@ class Bookmarks(LegacyBookmarks[str, MUC]):
232
241
  local_part.removeprefix("#") + "@" + whatsapp.DefaultGroupServer
233
242
  )
234
243
 
235
- if (
236
- self.xmpp.store.rooms.get_by_legacy_id(
237
- self.session.user_pk, whatsapp_group_id
238
- )
239
- is None
240
- ):
244
+ if not await self.by_legacy_id(whatsapp_group_id, create=False):
241
245
  raise XMPPError("item-not-found", f"No group found for {whatsapp_group_id}")
242
246
 
243
247
  return whatsapp_group_id
@@ -334,7 +334,7 @@ func processImage(img image.Image, spec *Spec) ([]byte, error) {
334
334
  o.Quality = jpeg.DefaultQuality
335
335
  }
336
336
 
337
- err = jpeg.Encode(&buf, img, nil)
337
+ err = jpeg.Encode(&buf, img, &o)
338
338
  case TypePNG:
339
339
  err = png.Encode(&buf, img)
340
340
  }
@@ -4,6 +4,7 @@ import (
4
4
  // Standard library.
5
5
  "bytes"
6
6
  "context"
7
+ "encoding/json"
7
8
  "errors"
8
9
  "fmt"
9
10
  "image/jpeg"
@@ -452,12 +453,16 @@ func (s *Session) GetContacts(refresh bool) ([]Contact, error) {
452
453
 
453
454
  var contacts []Contact
454
455
  for jid, info := range data {
456
+ c := newContact(jid, info)
457
+ if c.JID == "" {
458
+ continue
459
+ }
460
+
455
461
  if err = s.client.SubscribePresence(jid); err != nil {
456
462
  s.gateway.logger.Warnf("Failed to subscribe to presence for %s", jid)
457
463
  }
458
464
 
459
- _, c := newContactEvent(jid, info)
460
- contacts = append(contacts, c.Contact)
465
+ contacts = append(contacts, c)
461
466
  }
462
467
 
463
468
  return contacts, nil
@@ -466,6 +471,7 @@ func (s *Session) GetContacts(refresh bool) ([]Contact, error) {
466
471
  // GetGroups returns a list of all group-chats currently joined in WhatsApp, along with additional
467
472
  // information on present participants.
468
473
  func (s *Session) GetGroups() ([]Group, error) {
474
+ var ctx = context.Background()
469
475
  if s.client == nil || s.client.Store.ID == nil {
470
476
  return nil, fmt.Errorf("cannot get groups for unauthenticated session")
471
477
  }
@@ -477,7 +483,7 @@ func (s *Session) GetGroups() ([]Group, error) {
477
483
 
478
484
  var groups []Group
479
485
  for _, info := range data {
480
- groups = append(groups, newGroup(s.client, info))
486
+ groups = append(groups, newGroup(ctx, s.client, info))
481
487
  }
482
488
 
483
489
  return groups, nil
@@ -486,6 +492,7 @@ func (s *Session) GetGroups() ([]Group, error) {
486
492
  // CreateGroup attempts to create a new WhatsApp group for the given human-readable name and
487
493
  // participant JIDs given.
488
494
  func (s *Session) CreateGroup(name string, participants []string) (Group, error) {
495
+ var ctx = context.Background()
489
496
  if s.client == nil || s.client.Store.ID == nil {
490
497
  return Group{}, fmt.Errorf("cannot create group for unauthenticated session")
491
498
  }
@@ -501,12 +508,12 @@ func (s *Session) CreateGroup(name string, participants []string) (Group, error)
501
508
  }
502
509
 
503
510
  req := whatsmeow.ReqCreateGroup{Name: name, Participants: jids}
504
- info, err := s.client.CreateGroup(req)
511
+ info, err := s.client.CreateGroup(ctx, req)
505
512
  if err != nil {
506
513
  return Group{}, fmt.Errorf("could not create group: %s", err)
507
514
  }
508
515
 
509
- return newGroup(s.client, info), nil
516
+ return newGroup(ctx, s.client, info), nil
510
517
  }
511
518
 
512
519
  // LeaveGroup attempts to remove our own user from the given WhatsApp group, for the JID given.
@@ -647,7 +654,7 @@ func (s *Session) UpdateGroupParticipants(resourceID string, participants []Grou
647
654
  return nil, fmt.Errorf("failed setting group affiliation: %s", err)
648
655
  }
649
656
  for i := range participants {
650
- p := newGroupParticipant(participants[i])
657
+ p := newGroupParticipant(ctx, s.client, participants[i])
651
658
  if p.JID == "" {
652
659
  continue
653
660
  }
@@ -669,9 +676,9 @@ func (s *Session) FindContact(phone string) (Contact, error) {
669
676
  }
670
677
 
671
678
  jid := types.NewJID(phone, DefaultUserServer)
672
- if c, err := s.client.Store.Contacts.GetContact(ctx, jid); err == nil && c.Found {
673
- if _, e := newContactEvent(jid, c); e != nil {
674
- return e.Contact, nil
679
+ if info, err := s.client.Store.Contacts.GetContact(ctx, jid); err == nil && info.Found {
680
+ if c := newContact(jid, info); c.JID != "" {
681
+ return c, nil
675
682
  }
676
683
  }
677
684
 
@@ -747,7 +754,7 @@ func (s *Session) propagateEvent(kind EventKind, payload *EventPayload) {
747
754
  // errors that occur during processing are logged.
748
755
  func (s *Session) handleEvent(evt any) {
749
756
  var ctx = context.Background()
750
- s.gateway.logger.Debugf("Handling event '%T': %+v", evt, evt)
757
+ s.gateway.logger.Debugf("Handling event '%T': %+v", evt, jsonStringer{evt})
751
758
 
752
759
  switch evt := evt.(type) {
753
760
  case *events.AppStateSyncComplete:
@@ -789,22 +796,22 @@ func (s *Session) handleEvent(evt any) {
789
796
  case waHistorySync.HistorySync_INITIAL_BOOTSTRAP, waHistorySync.HistorySync_RECENT, waHistorySync.HistorySync_ON_DEMAND:
790
797
  for _, c := range evt.Data.GetConversations() {
791
798
  for _, msg := range c.GetMessages() {
792
- s.propagateEvent(newEventFromHistory(s.client, msg.GetMessage()))
799
+ s.propagateEvent(newEventFromHistory(ctx, s.client, msg.GetMessage()))
793
800
  }
794
801
  }
795
802
  }
796
803
  case *events.Message:
797
- s.propagateEvent(newMessageEvent(s.client, evt))
804
+ s.propagateEvent(newMessageEvent(ctx, s.client, evt))
798
805
  case *events.Receipt:
799
- s.propagateEvent(newReceiptEvent(evt))
806
+ s.propagateEvent(newReceiptEvent(ctx, s.client, evt))
800
807
  case *events.Presence:
801
808
  s.propagateEvent(newPresenceEvent(evt))
802
809
  case *events.PushName:
803
810
  s.propagateEvent(newContactEvent(evt.JID, types.ContactInfo{FullName: evt.NewPushName}))
804
811
  case *events.JoinedGroup:
805
- s.propagateEvent(EventGroup, &EventPayload{Group: newGroup(s.client, &evt.GroupInfo)})
812
+ s.propagateEvent(EventGroup, &EventPayload{Group: newGroup(ctx, s.client, &evt.GroupInfo)})
806
813
  case *events.GroupInfo:
807
- s.propagateEvent(newGroupEvent(evt))
814
+ s.propagateEvent(newGroupEvent(ctx, s.client, evt))
808
815
  case *events.ChatPresence:
809
816
  s.propagateEvent(newChatStateEvent(evt))
810
817
  case *events.CallOffer:
@@ -817,7 +824,7 @@ func (s *Session) handleEvent(evt any) {
817
824
  s.gateway.logger.Warnf("Unable to delete local device state on logout: %s", err)
818
825
  }
819
826
  s.client = nil
820
- s.propagateEvent(EventLoggedOut, nil)
827
+ s.propagateEvent(EventLoggedOut, &EventPayload{LoggedOut: LoggedOut{Reason: evt.Reason.String()}})
821
828
  case *events.PairSuccess:
822
829
  if s.client.Store.ID == nil {
823
830
  s.gateway.logger.Errorf("Pairing succeeded, but device ID is missing")
@@ -854,6 +861,16 @@ func (s *Session) handleEvent(evt any) {
854
861
  }
855
862
  }
856
863
 
864
+ // a JSONStringer is a value that returns a JSON-encoded, multi-line version of itself in calls to
865
+ // [String].
866
+ type jsonStringer struct{ v any }
867
+
868
+ // String returns a multi-line, indented, JSON representation of the [jsonStringer] value.
869
+ func (j jsonStringer) String() string {
870
+ buf, _ := json.MarshalIndent(j.v, "", " ")
871
+ return string(buf)
872
+ }
873
+
857
874
  // PtrTo returns a pointer to the given value, and is used for convenience when converting between
858
875
  // concrete and pointer values without assigning to a variable.
859
876
  func ptrTo[T any](t T) *T {
@@ -6,10 +6,12 @@ from pathlib import Path
6
6
  from re import search
7
7
  from typing import Any, Optional, Union, cast
8
8
 
9
+ import sqlalchemy
9
10
  from aiohttp import ClientSession
10
11
  from linkpreview import Link, LinkPreview
11
12
  from slidge import BaseSession, FormField, GatewayUser, SearchResult, global_config
12
13
  from slidge.contact.roster import ContactIsUser
14
+ from slidge.db.models import ArchivedMessage
13
15
  from slidge.util import is_valid_phone_number
14
16
  from slidge.util.types import (
15
17
  LegacyAttachment,
@@ -157,17 +159,24 @@ class Session(BaseSession[str, Recipient]):
157
159
  )
158
160
  elif event == whatsapp.EventLoggedOut:
159
161
  self.logged = False
160
- self.send_gateway_message(MESSAGE_LOGGED_OUT)
162
+ message = MESSAGE_LOGGED_OUT
163
+ if data.LoggedOut.Reason:
164
+ message += f"\nReason: {data.LoggedOut.Reason}"
165
+ self.send_gateway_message(message)
161
166
  self.send_gateway_status("Logged out", show="away")
162
167
  elif event == whatsapp.EventContact:
163
168
  contact = await self.contacts.add_whatsapp_contact(data.Contact)
164
- if contact is not None:
169
+ if contact is not None and contact.is_friend:
165
170
  await contact.add_to_roster()
166
171
  elif event == whatsapp.EventGroup:
167
172
  await self.bookmarks.add_whatsapp_group(data.Group)
168
173
  elif event == whatsapp.EventPresence:
169
- contact = await self.contacts.by_legacy_id(data.Presence.JID)
170
- await contact.update_presence(data.Presence.Kind, data.Presence.LastSeen)
174
+ if not whatsapp.IsAnonymousJID(data.Presence.JID):
175
+ contact = await self.contacts.by_legacy_id(data.Presence.JID)
176
+ if contact is not None:
177
+ await contact.update_presence(
178
+ data.Presence.Kind, data.Presence.LastSeen
179
+ )
171
180
  elif event == whatsapp.EventChatState:
172
181
  await self.handle_chat_state(data.ChatState)
173
182
  elif event == whatsapp.EventReceipt:
@@ -217,12 +226,22 @@ class Session(BaseSession[str, Recipient]):
217
226
  """
218
227
  contact = await self.__get_contact_or_participant(message.JID, message.GroupJID)
219
228
  muc = getattr(contact, "muc", None)
229
+ # Skip handing message that's already in our message archive.
230
+ if (
231
+ muc is not None
232
+ and message.IsHistory
233
+ and await self.__is_message_in_archive(message.ID)
234
+ ):
235
+ return
220
236
  reply_to = await self.__get_reply_to(message, muc)
221
237
  message_timestamp = (
222
238
  datetime.fromtimestamp(message.Timestamp, tz=timezone.utc)
223
239
  if message.Timestamp > 0
224
240
  else None
225
241
  )
242
+ if message.GroupInvite.JID:
243
+ text = f"Received group invite for xmpp:{message.GroupInvite.JID} from {contact.name}, auto-joining..."
244
+ self.send_gateway_message(text)
226
245
  if message.Kind == whatsapp.MessagePlain:
227
246
  body = await self.__get_body(message, muc)
228
247
  contact.send_text(
@@ -543,15 +562,13 @@ class Session(BaseSession[str, Recipient]):
543
562
  items=[{"phone": cast(str, phone), "jid": contact.jid.bare}],
544
563
  )
545
564
 
546
- def message_is_carbon(self, c: Recipient, legacy_msg_id: str):
547
- stored: Any
548
- if c.is_group:
549
- assert isinstance(c, MUC)
550
- assert c.pk is not None
551
- stored = self.xmpp.store.sent.get_group_xmpp_id(c.pk, legacy_msg_id)
552
- else:
553
- stored = self.xmpp.store.sent.get_xmpp_id(self.user_pk, legacy_msg_id)
554
- return stored is not None
565
+ def message_is_carbon(self, c: Recipient, legacy_msg_id: str) -> bool:
566
+ with self.xmpp.store.session() as orm:
567
+ return bool(
568
+ self.xmpp.store.id_map.get_xmpp(
569
+ orm, c.stored.id, legacy_msg_id, c.is_group
570
+ )
571
+ )
555
572
 
556
573
  def __reset_connected(self):
557
574
  if hasattr(self, "_connected") and not self.__connected.done():
@@ -675,6 +692,16 @@ class Session(BaseSession[str, Recipient]):
675
692
  Accuracy=int(match.group("acc") or 0),
676
693
  )
677
694
 
695
+ async def __is_message_in_archive(self, legacy_msg_id: str) -> bool:
696
+ with self.xmpp.store.session() as orm:
697
+ return bool(
698
+ orm.scalar(
699
+ sqlalchemy.exists()
700
+ .where(ArchivedMessage.legacy_id == legacy_msg_id)
701
+ .select()
702
+ )
703
+ )
704
+
678
705
  async def __get_contact_or_participant(
679
706
  self, legacy_contact_id: str, legacy_group_jid: str
680
707
  ):
@@ -683,7 +710,12 @@ class Session(BaseSession[str, Recipient]):
683
710
  """
684
711
  if legacy_group_jid:
685
712
  muc = await self.bookmarks.by_legacy_id(legacy_group_jid)
686
- return await muc.get_participant_by_legacy_id(legacy_contact_id)
713
+ if whatsapp.IsAnonymousJID(legacy_contact_id):
714
+ return await muc.get_participant(legacy_contact_id)
715
+ else:
716
+ return await muc.get_participant_by_legacy_id(legacy_contact_id)
717
+ elif whatsapp.IsAnonymousJID(legacy_contact_id):
718
+ raise ValueError("Contact for anonymous JID")
687
719
  else:
688
720
  return await self.contacts.by_legacy_id(legacy_contact_id)
689
721
 
@@ -0,0 +1,9 @@
1
+
2
+
3
+ Copyright 2025 Automattic Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.