slidge-whatsapp 0.2.6__cp312-cp312-manylinux_2_36_aarch64.whl → 0.3.0__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.

Potentially problematic release.


This version of slidge-whatsapp might be problematic. Click here for more details.

Files changed (258) hide show
  1. slidge_whatsapp/contact.py +15 -3
  2. slidge_whatsapp/event.go +152 -50
  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 +185 -168
  6. slidge_whatsapp/generated/_whatsapp.cpython-312-aarch64-linux-gnu.so +0 -0
  7. slidge_whatsapp/generated/build.py +149 -135
  8. slidge_whatsapp/generated/whatsapp.c +1883 -1611
  9. slidge_whatsapp/generated/whatsapp.go +1157 -1046
  10. slidge_whatsapp/generated/whatsapp.py +1326 -1201
  11. slidge_whatsapp/generated/whatsapp_go.h +185 -168
  12. slidge_whatsapp/go.mod +18 -15
  13. slidge_whatsapp/go.sum +38 -32
  14. slidge_whatsapp/group.py +34 -30
  15. slidge_whatsapp/media/media.go +6 -2
  16. slidge_whatsapp/session.go +34 -17
  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/json.go +1 -6
  84. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/networkerror.go +2 -1
  85. slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +104 -0
  86. slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +19 -3
  87. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/.pre-commit-config.yaml +3 -3
  88. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -1
  89. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -1
  90. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +5 -1
  91. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo-wire-type-store.argo +63 -0
  92. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo.go +62 -0
  93. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/name-to-queryids.json +306 -0
  94. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +40 -7
  95. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/binary/encoder.go +1 -1
  96. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +2 -1
  97. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +79 -45
  98. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +13 -6
  99. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download-to-file.go +19 -12
  100. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +26 -6
  101. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +3 -0
  102. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +99 -27
  103. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +54 -26
  104. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +1 -0
  105. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +208 -57
  106. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +2 -14
  107. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/newsletter.go +83 -7
  108. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +17 -8
  109. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +2 -2
  110. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +15 -6
  111. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/extra.go +7 -0
  112. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +983 -0
  113. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.proto +85 -0
  114. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/extra.go +3 -0
  115. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +197 -0
  116. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.proto +13 -0
  117. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +279 -0
  118. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.proto +21 -0
  119. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +137 -0
  120. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.proto +10 -0
  121. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +313 -0
  122. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.proto +27 -0
  123. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1299 -0
  124. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.proto +112 -0
  125. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +514 -0
  126. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.proto +47 -0
  127. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +123 -0
  128. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.proto +7 -0
  129. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/extra.go +3 -0
  130. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +720 -0
  131. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.proto +59 -0
  132. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/extra.go +3 -0
  133. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +365 -0
  134. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.proto +33 -0
  135. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1238 -0
  136. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.proto +105 -0
  137. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +16 -4
  138. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +3 -0
  139. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +5156 -0
  140. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.proto +516 -0
  141. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.pb.go +46 -10
  142. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WACompanionReg.proto +4 -0
  143. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8975 -11209
  144. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +193 -421
  145. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +52 -23
  146. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +3 -0
  147. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +198 -0
  148. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.proto +14 -0
  149. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/extra.go +7 -6
  150. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +952 -0
  151. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +88 -0
  152. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +1143 -463
  153. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +60 -0
  154. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +60 -38
  155. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +3 -0
  156. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +11 -3
  157. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +2 -0
  158. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +20 -7
  159. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingfields.json +1 -0
  160. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingtoken.go +176 -0
  161. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +10 -2
  162. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +38 -21
  163. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +1 -0
  164. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
  165. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +3 -2
  166. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +9 -6
  167. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +25 -5
  168. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +4 -2
  169. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/10-chat-db-lid-migration-ts.sql +2 -0
  170. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +5 -1
  171. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +1 -0
  172. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +13 -2
  173. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +2 -1
  174. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +1 -0
  175. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +2 -0
  176. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +14 -8
  177. slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +1 -1
  178. slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +44 -2
  179. slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +8 -8
  180. slidge_whatsapp/vendor/golang.org/x/net/http2/gotrack.go +14 -3
  181. slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +7 -29
  182. slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +53 -71
  183. slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +20 -74
  184. slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +1 -3
  185. slidge_whatsapp/vendor/golang.org/x/sys/unix/mkerrors.sh +3 -0
  186. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_darwin.go +1 -55
  187. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_solaris.go +1 -1
  188. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux.go +47 -16
  189. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +3 -0
  190. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +3 -0
  191. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +3 -0
  192. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +3 -0
  193. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +3 -0
  194. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +3 -0
  195. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +3 -0
  196. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +3 -0
  197. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +3 -0
  198. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +3 -0
  199. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +3 -0
  200. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +3 -0
  201. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +3 -0
  202. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +3 -0
  203. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +3 -0
  204. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +4 -4
  205. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +1 -0
  206. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +1 -0
  207. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +1 -0
  208. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +1 -0
  209. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +1 -0
  210. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +1 -0
  211. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +1 -0
  212. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +1 -0
  213. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +1 -0
  214. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +1 -0
  215. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +1 -0
  216. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +1 -0
  217. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +1 -0
  218. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +1 -0
  219. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +1 -0
  220. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux.go +168 -12
  221. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +17 -1
  222. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +16 -0
  223. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +18 -2
  224. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +16 -0
  225. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +16 -0
  226. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +17 -1
  227. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +16 -0
  228. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +16 -0
  229. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +17 -1
  230. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +18 -2
  231. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +16 -0
  232. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +16 -0
  233. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +16 -0
  234. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +16 -0
  235. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +16 -0
  236. slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +6 -0
  237. slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +483 -483
  238. slidge_whatsapp/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +25 -1
  239. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +0 -0
  240. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +10 -5
  241. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/presence.go +33 -0
  242. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +6 -0
  243. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +68 -22
  244. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go +2 -1
  245. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go +8 -37
  246. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/presence.go +0 -3
  247. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
  248. slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +8 -0
  249. slidge_whatsapp/vendor/modules.txt +57 -23
  250. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/METADATA +5 -4
  251. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/RECORD +254 -174
  252. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/WHEEL +1 -1
  253. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi_amd64.go +0 -7
  254. slidge_whatsapp/vendor/golang.org/x/net/http2/config_go124.go +0 -61
  255. slidge_whatsapp/vendor/golang.org/x/net/http2/config_pre_go124.go +0 -16
  256. slidge_whatsapp/vendor/golang.org/x/net/http2/timer.go +0 -20
  257. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info}/entry_points.txt +0 -0
  258. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0.dist-info/licenses}/LICENSE +0 -0
@@ -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
- avatar = self.session.whatsapp.GetAvatar(data.JID, contact.avatar or "")
58
- if avatar.URL and contact.avatar != avatar.ID:
59
- await contact.set_avatar(avatar.URL, avatar.ID)
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:
@@ -67,6 +77,8 @@ class Roster(LegacyRoster[str, Contact]):
67
77
  return contact
68
78
 
69
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")
70
82
  return "+" + legacy_id[: legacy_id.find("@")]
71
83
 
72
84
  async def jid_username_to_legacy_id(self, jid_username: str) -> str:
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
- var contact = Contact{
86
- JID: jid.ToNonAD().String(),
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 EventUnknown, nil
118
+ return Contact{}
99
119
  }
100
120
 
101
- return EventContact, &EventPayload{Contact: contact}
121
+ return contact
102
122
  }
103
123
 
104
124
  // PresenceKind represents the different kinds of activity states possible in WhatsApp.
@@ -122,6 +142,10 @@ type Presence struct {
122
142
  // NewPresenceEvent returns event data meant for [Session.propagateEvent] for the primitive presence
123
143
  // event given.
124
144
  func newPresenceEvent(evt *events.Presence) (EventKind, *EventPayload) {
145
+ if evt.From.Server == types.HiddenUserServer {
146
+ return EventUnknown, nil
147
+ }
148
+
125
149
  var presence = Presence{
126
150
  JID: evt.From.ToNonAD().String(),
127
151
  Kind: PresenceAvailable,
@@ -169,9 +193,11 @@ type Message struct {
169
193
  Location Location // The location metadata for messages, if any.
170
194
  Poll Poll // The multiple-choice poll contained in the message, if any.
171
195
  Album Album // The image album message, if any.
196
+ GroupInvite Group // Group information for the invite group included in this message, if any.
172
197
  MentionJIDs []string // A list of JIDs mentioned in this message, if any.
173
198
  Receipts []Receipt // The receipt statuses for the message, typically provided alongside historical messages.
174
199
  Reactions []Message // Reactions attached to message, typically provided alongside historical messages.
200
+ IsHistory bool // Whether or not the message is derived from message history.
175
201
  }
176
202
 
177
203
  // A Attachment represents additional binary data (e.g. images, videos, documents) provided alongside
@@ -253,14 +279,13 @@ type Album struct {
253
279
 
254
280
  // NewMessageEvent returns event data meant for [Session.propagateEvent] for the primive message
255
281
  // 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) {
282
+ func newMessageEvent(ctx context.Context, client *whatsmeow.Client, evt *events.Message) (EventKind, *EventPayload) {
257
283
  // Set basic data for message, to be potentially amended depending on the concrete version of
258
284
  // the underlying message.
259
- var ctx = context.Background()
260
285
  var message = Message{
261
286
  Kind: MessagePlain,
262
287
  ID: evt.Info.ID,
263
- JID: evt.Info.Sender.ToNonAD().String(),
288
+ JID: getPreferredJID(ctx, client, evt.Info.Sender, evt.Info.SenderAlt).ToNonAD().String(),
264
289
  Body: evt.Message.GetConversation(),
265
290
  Timestamp: evt.Info.Timestamp.Unix(),
266
291
  IsCarbon: evt.Info.IsFromMe,
@@ -378,7 +403,18 @@ func newMessageEvent(client *whatsmeow.Client, evt *events.Message) (EventKind,
378
403
  message.Body = e.GetText()
379
404
  }
380
405
 
381
- message = getMessageWithContext(message, e.GetContextInfo())
406
+ // Handle group-chat invite link in text message.
407
+ if code, ok := strings.CutPrefix(e.GetMatchedText(), whatsmeow.InviteLinkPrefix); ok {
408
+ if info, err := client.GetGroupInfoFromLink(e.GetMatchedText()); err != nil {
409
+ client.Log.Errorf("Failed getting group info from invite: %s", err)
410
+ } else if _, err := client.JoinGroupWithLink(code); err != nil {
411
+ client.Log.Errorf("Failed joining group with invite: %s", err)
412
+ } else {
413
+ message.GroupInvite = newGroup(ctx, client, info)
414
+ }
415
+ } else {
416
+ message = getMessageWithContext(message, e.GetContextInfo())
417
+ }
382
418
  }
383
419
 
384
420
  // Ignore obviously invalid messages.
@@ -424,6 +460,7 @@ func getMessageAttachments(ctx context.Context, client *whatsmeow.Client, messag
424
460
  message.GetVideoMessage(),
425
461
  message.GetDocumentMessage(),
426
462
  message.GetStickerMessage(),
463
+ message.GetPtvMessage(),
427
464
  }
428
465
 
429
466
  for _, msg := range kinds {
@@ -462,7 +499,9 @@ func getMessageAttachments(ctx context.Context, client *whatsmeow.Client, messag
462
499
  // Convert incoming data if a specification has been given, ignoring any errors that occur.
463
500
  if convertSpec != nil {
464
501
  data, err = media.Convert(ctx, a.Data, convertSpec)
465
- if err == nil {
502
+ if err != nil {
503
+ client.Log.Warnf("failed to convert incoming attachment: %s", err)
504
+ } else {
466
505
  a.Data, a.MIME = data, string(convertSpec.MIME)
467
506
  }
468
507
  }
@@ -648,6 +687,10 @@ func convertAttachment(ctx context.Context, attach *Attachment) error {
648
687
  }
649
688
 
650
689
  attach.Data, attach.MIME = data, string(spec.MIME)
690
+ if i := strings.LastIndexByte(attach.Filename, '.'); i != -1 {
691
+ attach.Filename = attach.Filename[:i] + extensionByType(attach.MIME)
692
+ }
693
+
651
694
  return nil
652
695
  }
653
696
 
@@ -669,7 +712,7 @@ var knownMediaTypes = map[string]whatsmeow.MediaType{
669
712
  func uploadAttachment(ctx context.Context, client *whatsmeow.Client, attach *Attachment) (*waE2E.Message, error) {
670
713
  var originalMIME = attach.MIME
671
714
  if err := convertAttachment(ctx, attach); err != nil {
672
- client.Log.Warnf("failed to auto-convert attachment: %s", err)
715
+ client.Log.Warnf("failed to convert outgoing attachment: %s", err)
673
716
  }
674
717
 
675
718
  mediaType := knownMediaTypes[getBaseMediaType(attach.MIME)]
@@ -831,10 +874,9 @@ func getBaseMediaType(typ string) string {
831
874
  //
832
875
  // Typically, this will return [EventMessage] events with appropriate [Message] payloads; unknown or
833
876
  // invalid messages will return an [EventUnknown] event with nil data.
834
- func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (EventKind, *EventPayload) {
877
+ func newEventFromHistory(ctx context.Context, client *whatsmeow.Client, info *waWeb.WebMessageInfo) (EventKind, *EventPayload) {
835
878
  // Handle message as group message is remote JID is a group JID in the absence of any other,
836
879
  // specific signal, or don't handle at all if no group JID is found.
837
- var ctx = context.Background()
838
880
  var jid = info.GetKey().GetRemoteJID()
839
881
  if j, _ := types.ParseJID(jid); j.Server != types.GroupServer {
840
882
  return EventUnknown, nil
@@ -849,10 +891,15 @@ func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (
849
891
  Body: info.GetMessage().GetConversation(),
850
892
  Timestamp: int64(info.GetMessageTimestamp()),
851
893
  IsCarbon: info.GetKey().GetFromMe(),
894
+ IsHistory: true,
852
895
  }
853
896
 
854
897
  if info.Participant != nil {
855
- message.JID = info.GetParticipant()
898
+ jid, err := types.ParseJID(info.GetParticipant())
899
+ if err != nil {
900
+ return EventUnknown, nil
901
+ }
902
+ message.JID = getPreferredJID(ctx, client, jid).ToNonAD().String()
856
903
  } else if info.GetKey().GetFromMe() {
857
904
  message.JID = client.Store.ID.ToNonAD().String()
858
905
  } else {
@@ -867,9 +914,13 @@ func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (
867
914
  case waWeb.WebMessageInfo_CIPHERTEXT:
868
915
  return EventUnknown, nil
869
916
  case waWeb.WebMessageInfo_CALL_MISSED_VOICE, waWeb.WebMessageInfo_CALL_MISSED_VIDEO:
917
+ jid, err := types.ParseJID(info.GetKey().GetParticipant())
918
+ if err != nil {
919
+ return EventUnknown, nil
920
+ }
870
921
  return EventCall, &EventPayload{Call: Call{
871
922
  State: CallMissed,
872
- JID: info.GetKey().GetRemoteJID(),
923
+ JID: getPreferredJID(ctx, client, jid).ToNonAD().String(),
873
924
  Timestamp: int64(info.GetMessageTimestamp()),
874
925
  }}
875
926
  case waWeb.WebMessageInfo_REVOKE:
@@ -885,10 +936,14 @@ func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (
885
936
  // Handle emoji reaction to existing message.
886
937
  for _, r := range info.GetReactions() {
887
938
  if r.GetText() != "" {
939
+ jid, err := types.ParseJID(r.GetKey().GetParticipant())
940
+ if err != nil {
941
+ continue
942
+ }
888
943
  message.Reactions = append(message.Reactions, Message{
889
944
  Kind: MessageReaction,
890
945
  ID: r.GetKey().GetID(),
891
- JID: r.GetKey().GetRemoteJID(),
946
+ JID: getPreferredJID(ctx, client, jid).ToNonAD().String(),
892
947
  Body: r.GetText(),
893
948
  Timestamp: r.GetSenderTimestampMS() / 1000,
894
949
  IsCarbon: r.GetKey().GetFromMe(),
@@ -914,7 +969,15 @@ func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (
914
969
  if client.Store.ID.ToNonAD().String() == r.GetUserJID() {
915
970
  continue
916
971
  }
917
- var receipt = Receipt{MessageIDs: []string{message.ID}, JID: r.GetUserJID(), GroupJID: message.GroupJID}
972
+ jid, err := types.ParseJID(r.GetUserJID())
973
+ if err != nil {
974
+ continue
975
+ }
976
+ var receipt = Receipt{
977
+ JID: getPreferredJID(ctx, client, jid).ToNonAD().String(),
978
+ GroupJID: message.GroupJID,
979
+ MessageIDs: []string{message.ID},
980
+ }
918
981
  switch info.GetStatus() {
919
982
  case waWeb.WebMessageInfo_DELIVERY_ACK:
920
983
  receipt.Kind = ReceiptDelivered
@@ -932,7 +995,6 @@ func newEventFromHistory(client *whatsmeow.Client, info *waWeb.WebMessageInfo) (
932
995
  if message.Body == "" {
933
996
  message.Body = e.GetText()
934
997
  }
935
-
936
998
  message = getMessageWithContext(message, e.GetContextInfo())
937
999
  }
938
1000
 
@@ -965,8 +1027,10 @@ type ChatState struct {
965
1027
 
966
1028
  // NewChatStateEvent returns event data meant for [Session.propagateEvent] for the primitive
967
1029
  // chat-state event given.
968
- func newChatStateEvent(evt *events.ChatPresence) (EventKind, *EventPayload) {
969
- var state = ChatState{JID: evt.Sender.ToNonAD().String()}
1030
+ func newChatStateEvent(ctx context.Context, client *whatsmeow.Client, evt *events.ChatPresence) (EventKind, *EventPayload) {
1031
+ var state = ChatState{
1032
+ JID: getPreferredJID(ctx, client, evt.Sender, evt.SenderAlt).ToNonAD().String(),
1033
+ }
970
1034
  if evt.IsGroup {
971
1035
  state.GroupJID = evt.Chat.ToNonAD().String()
972
1036
  }
@@ -1003,10 +1067,10 @@ type Receipt struct {
1003
1067
 
1004
1068
  // NewReceiptEvent returns event data meant for [Session.propagateEvent] for the primive receipt
1005
1069
  // event given. Unknown or invalid receipts will return an [EventUnknown] event with nil data.
1006
- func newReceiptEvent(evt *events.Receipt) (EventKind, *EventPayload) {
1070
+ func newReceiptEvent(ctx context.Context, client *whatsmeow.Client, evt *events.Receipt) (EventKind, *EventPayload) {
1007
1071
  var receipt = Receipt{
1008
1072
  MessageIDs: slices.Clone(evt.MessageIDs),
1009
- JID: evt.Sender.ToNonAD().String(),
1073
+ JID: getPreferredJID(ctx, client, evt.Sender, evt.SenderAlt).ToNonAD().String(),
1010
1074
  Timestamp: evt.Timestamp.Unix(),
1011
1075
  IsCarbon: evt.IsFromMe,
1012
1076
  }
@@ -1053,14 +1117,15 @@ type Group struct {
1053
1117
  Subject GroupSubject // The longer-form, user-defined description for this group.
1054
1118
  Nickname string // Our own nickname in this group-chat.
1055
1119
  Participants []GroupParticipant // The list of participant contacts for this group, including ourselves.
1120
+ InviteCode string // The code for inviting members to this group-chat.
1056
1121
  }
1057
1122
 
1058
1123
  // A GroupSubject represents the user-defined group description and attached metadata thereof, for a
1059
1124
  // given [Group].
1060
1125
  type GroupSubject struct {
1061
- Subject string // The user-defined group description.
1062
- SetAt int64 // The exact time this group description was set at, as a timestamp.
1063
- SetByJID string // The JID of the user that set the subject.
1126
+ Subject string // The user-defined group description.
1127
+ SetAt int64 // The exact time this group description was set at, as a timestamp.
1128
+ SetBy string // The name of the user that set the subject.
1064
1129
  }
1065
1130
 
1066
1131
  // GroupParticipantAction represents the distinct set of actions that can be taken when encountering
@@ -1090,10 +1155,11 @@ func (a GroupParticipantAction) toParticipantChange() whatsmeow.ParticipantChang
1090
1155
  }
1091
1156
 
1092
1157
  // A GroupParticipant represents a contact who is currently joined in a given group. Participants in
1093
- // WhatsApp can always be derived back to their individual [Contact]; there are no anonymous groups
1158
+ // WhatsApp can generally be derived back to their individual [Contact]; there are no anonymous groups
1094
1159
  // in WhatsApp.
1095
1160
  type GroupParticipant struct {
1096
1161
  JID string // The WhatsApp JID for this participant.
1162
+ Nickname string // The user-set name for this participant, typically only set for anonymous participants.
1097
1163
  Affiliation GroupAffiliation // The set of priviledges given to this specific participant.
1098
1164
  Action GroupParticipantAction // The specific action to take for this participant; typically to add.
1099
1165
  }
@@ -1101,59 +1167,67 @@ type GroupParticipant struct {
1101
1167
  // NewGroupParticipant returns a [GroupParticipant], filling fields from the internal participant
1102
1168
  // type. This is a no-op if [types.GroupParticipant.Error] is non-zero, and other fields may only
1103
1169
  // be set optionally.
1104
- func newGroupParticipant(p types.GroupParticipant) GroupParticipant {
1105
- if p.Error > 0 {
1170
+ func newGroupParticipant(ctx context.Context, client *whatsmeow.Client, participant types.GroupParticipant) GroupParticipant {
1171
+ if participant.Error > 0 {
1106
1172
  return GroupParticipant{}
1107
1173
  }
1108
- var affiliation = GroupAffiliationNone
1109
- if p.IsSuperAdmin {
1110
- affiliation = GroupAffiliationOwner
1111
- } else if p.IsAdmin {
1112
- affiliation = GroupAffiliationAdmin
1174
+ var jid = getPreferredJID(ctx, client, participant.JID, participant.PhoneNumber)
1175
+ var p = GroupParticipant{
1176
+ JID: jid.ToNonAD().String(),
1177
+ }
1178
+ if participant.IsSuperAdmin {
1179
+ p.Affiliation = GroupAffiliationOwner
1180
+ } else if participant.IsAdmin {
1181
+ p.Affiliation = GroupAffiliationAdmin
1113
1182
  }
1114
- return GroupParticipant{
1115
- JID: p.JID.ToNonAD().String(),
1116
- Affiliation: affiliation,
1183
+ if IsAnonymousJID(p.JID) {
1184
+ if c, err := client.Store.Contacts.GetContact(ctx, participant.JID); err == nil {
1185
+ p.Nickname = c.PushName
1186
+ }
1117
1187
  }
1188
+ return p
1118
1189
  }
1119
1190
 
1120
1191
  // NewGroupEvent returns event data meant for [Session.propagateEvent] for the primive group event
1121
1192
  // given. Group data returned by this function can be partial, and callers should take care to only
1122
1193
  // handle non-empty values.
1123
- func newGroupEvent(evt *events.GroupInfo) (EventKind, *EventPayload) {
1194
+ func newGroupEvent(ctx context.Context, client *whatsmeow.Client, evt *events.GroupInfo) (EventKind, *EventPayload) {
1124
1195
  var group = Group{JID: evt.JID.ToNonAD().String()}
1125
1196
  if evt.Name != nil {
1126
1197
  group.Name = evt.Name.Name
1127
1198
  }
1128
1199
  if evt.Topic != nil {
1200
+ topicJID := getPreferredJID(ctx, client, evt.Topic.TopicSetBy, evt.Topic.TopicSetByPN)
1129
1201
  group.Subject = GroupSubject{
1130
- Subject: evt.Topic.Topic,
1131
- SetAt: evt.Topic.TopicSetAt.Unix(),
1132
- SetByJID: evt.Topic.TopicSetBy.ToNonAD().String(),
1202
+ Subject: evt.Topic.Topic,
1203
+ SetAt: evt.Topic.TopicSetAt.Unix(),
1204
+ }
1205
+ if c, err := client.Store.Contacts.GetContact(ctx, topicJID); err == nil {
1206
+ group.Subject.SetBy = c.PushName
1133
1207
  }
1134
1208
  }
1135
1209
  for _, p := range evt.Join {
1136
1210
  group.Participants = append(group.Participants, GroupParticipant{
1137
- JID: p.ToNonAD().String(),
1211
+ JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
1138
1212
  Action: GroupParticipantActionAdd,
1139
1213
  })
1140
1214
  }
1141
1215
  for _, p := range evt.Leave {
1142
1216
  group.Participants = append(group.Participants, GroupParticipant{
1143
- JID: p.ToNonAD().String(),
1217
+ JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
1144
1218
  Action: GroupParticipantActionRemove,
1145
1219
  })
1146
1220
  }
1147
1221
  for _, p := range evt.Promote {
1148
1222
  group.Participants = append(group.Participants, GroupParticipant{
1149
- JID: p.ToNonAD().String(),
1223
+ JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
1150
1224
  Action: GroupParticipantActionPromote,
1151
1225
  Affiliation: GroupAffiliationAdmin,
1152
1226
  })
1153
1227
  }
1154
1228
  for _, p := range evt.Demote {
1155
1229
  group.Participants = append(group.Participants, GroupParticipant{
1156
- JID: p.ToNonAD().String(),
1230
+ JID: getPreferredJID(ctx, client, p).ToNonAD().String(),
1157
1231
  Action: GroupParticipantActionDemote,
1158
1232
  Affiliation: GroupAffiliationNone,
1159
1233
  })
@@ -1164,26 +1238,32 @@ func newGroupEvent(evt *events.GroupInfo) (EventKind, *EventPayload) {
1164
1238
  // NewGroup returns a concrete [Group] for the primitive data given. This function will generally
1165
1239
  // populate fields with as much data as is available from the remote, and is therefore should not
1166
1240
  // be called when partial data is to be returned.
1167
- func newGroup(client *whatsmeow.Client, info *types.GroupInfo) Group {
1241
+ func newGroup(ctx context.Context, client *whatsmeow.Client, info *types.GroupInfo) Group {
1168
1242
  var participants []GroupParticipant
1169
1243
  for i := range info.Participants {
1170
- p := newGroupParticipant(info.Participants[i])
1244
+ p := newGroupParticipant(ctx, client, info.Participants[i])
1171
1245
  if p.JID == "" {
1172
1246
  continue
1173
1247
  }
1174
1248
  participants = append(participants, p)
1175
1249
  }
1176
- return Group{
1250
+
1251
+ var topicJID = getPreferredJID(ctx, client, info.TopicSetBy, info.TopicSetByPN)
1252
+ var group = Group{
1177
1253
  JID: info.JID.ToNonAD().String(),
1178
1254
  Name: info.Name,
1179
1255
  Subject: GroupSubject{
1180
- Subject: info.Topic,
1181
- SetAt: info.TopicSetAt.Unix(),
1182
- SetByJID: info.TopicSetBy.ToNonAD().String(),
1256
+ Subject: info.Topic,
1257
+ SetAt: info.TopicSetAt.Unix(),
1183
1258
  },
1184
1259
  Nickname: client.Store.PushName,
1185
1260
  Participants: participants,
1186
1261
  }
1262
+ if c, err := client.Store.Contacts.GetContact(ctx, topicJID); err == nil {
1263
+ group.Subject.SetBy = c.PushName
1264
+ }
1265
+
1266
+ return group
1187
1267
  }
1188
1268
 
1189
1269
  // CallState represents the state of the call to synchronize with.
@@ -1228,3 +1308,25 @@ func newCallEvent(state CallState, meta types.BasicCallMeta) (EventKind, *EventP
1228
1308
  Timestamp: meta.Timestamp.Unix(),
1229
1309
  }}
1230
1310
  }
1311
+
1312
+ // GetPreferredJID returns one of the [type.JID] values for the given senders, preferring the first
1313
+ // non-empty, non-hidden sender; if none are found, mappings from LID to JID are tried, or otherwise,
1314
+ // the first JID given is returned.
1315
+ func getPreferredJID(ctx context.Context, client *whatsmeow.Client, def types.JID, alt ...types.JID) types.JID {
1316
+ var jids = append([]types.JID{def}, alt...)
1317
+ for _, s := range jids {
1318
+ if !s.IsEmpty() && s.Server != types.HiddenUserServer {
1319
+ return s
1320
+ }
1321
+ }
1322
+
1323
+ for _, s := range jids {
1324
+ if !s.IsEmpty() && s.Server == types.HiddenUserServer {
1325
+ if p, _ := client.Store.LIDs.GetPNForLID(ctx, s); !p.IsEmpty() {
1326
+ return p
1327
+ }
1328
+ }
1329
+ }
1330
+
1331
+ return def
1332
+ }
@@ -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 = 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
- }
@@ -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, GatewayUser, global_config
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, user: GatewayUser):
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"]