slidge-whatsapp 0.2.6__cp313-cp313-manylinux_2_36_aarch64.whl → 0.3.0b0__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.

Files changed (258) hide show
  1. slidge_whatsapp/contact.py +13 -3
  2. slidge_whatsapp/event.go +115 -39
  3. slidge_whatsapp/gateway.go +7 -63
  4. slidge_whatsapp/gateway.py +2 -3
  5. slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.h +156 -139
  6. slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.so +0 -0
  7. slidge_whatsapp/generated/build.py +135 -121
  8. slidge_whatsapp/generated/whatsapp.c +1441 -1169
  9. slidge_whatsapp/generated/whatsapp.go +1090 -979
  10. slidge_whatsapp/generated/whatsapp.py +854 -729
  11. slidge_whatsapp/generated/whatsapp_go.h +156 -139
  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 +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/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.0b0.dist-info}/METADATA +2 -2
  251. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/RECORD +254 -174
  252. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi_amd64.go +0 -7
  253. slidge_whatsapp/vendor/golang.org/x/net/http2/config_go124.go +0 -61
  254. slidge_whatsapp/vendor/golang.org/x/net/http2/config_pre_go124.go +0 -16
  255. slidge_whatsapp/vendor/golang.org/x/net/http2/timer.go +0 -20
  256. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/LICENSE +0 -0
  257. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/WHEEL +0 -0
  258. {slidge_whatsapp-0.2.6.dist-info → slidge_whatsapp-0.3.0b0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,72 @@
1
+ package ast
2
+
3
+ import (
4
+ "bytes"
5
+ "encoding/json"
6
+ "fmt"
7
+ )
8
+
9
+ var _ json.Unmarshaler = (*Path)(nil)
10
+
11
+ type Path []PathElement
12
+
13
+ type PathElement interface {
14
+ isPathElement()
15
+ }
16
+
17
+ var (
18
+ _ PathElement = PathIndex(0)
19
+ _ PathElement = PathName("")
20
+ )
21
+
22
+ func (path Path) String() string {
23
+ if path == nil {
24
+ return ""
25
+ }
26
+ var str bytes.Buffer
27
+ for i, v := range path {
28
+ switch v := v.(type) {
29
+ case PathIndex:
30
+ str.WriteString(fmt.Sprintf("[%d]", v))
31
+ case PathName:
32
+ if i != 0 {
33
+ str.WriteByte('.')
34
+ }
35
+ str.WriteString(string(v))
36
+ default:
37
+ panic(fmt.Sprintf("unknown type: %T", v))
38
+ }
39
+ }
40
+ return str.String()
41
+ }
42
+
43
+ func (path *Path) UnmarshalJSON(b []byte) error {
44
+ var vs []interface{}
45
+ err := json.Unmarshal(b, &vs)
46
+ if err != nil {
47
+ return err
48
+ }
49
+
50
+ *path = make([]PathElement, 0, len(vs))
51
+ for _, v := range vs {
52
+ switch v := v.(type) {
53
+ case string:
54
+ *path = append(*path, PathName(v))
55
+ case int:
56
+ *path = append(*path, PathIndex(v))
57
+ case float64:
58
+ *path = append(*path, PathIndex(int(v)))
59
+ default:
60
+ return fmt.Errorf("unknown path element type: %T", v)
61
+ }
62
+ }
63
+ return nil
64
+ }
65
+
66
+ type PathIndex int
67
+
68
+ func (PathIndex) isPathElement() {}
69
+
70
+ type PathName string
71
+
72
+ func (PathName) isPathElement() {}
@@ -0,0 +1,41 @@
1
+ package ast
2
+
3
+ type SelectionSet []Selection
4
+
5
+ type Selection interface {
6
+ isSelection()
7
+ GetPosition() *Position
8
+ }
9
+
10
+ func (*Field) isSelection() {}
11
+ func (*FragmentSpread) isSelection() {}
12
+ func (*InlineFragment) isSelection() {}
13
+
14
+ func (f *Field) GetPosition() *Position { return f.Position }
15
+ func (s *FragmentSpread) GetPosition() *Position { return s.Position }
16
+ func (f *InlineFragment) GetPosition() *Position { return f.Position }
17
+
18
+ type Field struct {
19
+ Alias string
20
+ Name string
21
+ Arguments ArgumentList
22
+ Directives DirectiveList
23
+ SelectionSet SelectionSet
24
+ Position *Position `dump:"-" json:"-"`
25
+ Comment *CommentGroup
26
+
27
+ // Require validation
28
+ Definition *FieldDefinition
29
+ ObjectDefinition *Definition
30
+ }
31
+
32
+ type Argument struct {
33
+ Name string
34
+ Value *Value
35
+ Position *Position `dump:"-" json:"-"`
36
+ Comment *CommentGroup
37
+ }
38
+
39
+ func (f *Field) ArgumentMap(vars map[string]interface{}) map[string]interface{} {
40
+ return arg2map(f.Definition.Arguments, f.Arguments, vars)
41
+ }
@@ -0,0 +1,19 @@
1
+ package ast
2
+
3
+ // Source covers a single *.graphql file
4
+ type Source struct {
5
+ // Name is the filename of the source
6
+ Name string
7
+ // Input is the actual contents of the source file
8
+ Input string
9
+ // BuiltIn indicate whether the source is a part of the specification
10
+ BuiltIn bool
11
+ }
12
+
13
+ type Position struct {
14
+ Start int // The starting position, in runes, of this token in the input.
15
+ End int // The end position, in runes, of this token in the input.
16
+ Line int // The line number at the start of this item.
17
+ Column int // The column number at the start of this item.
18
+ Src *Source // The source document this token belongs to
19
+ }
@@ -0,0 +1,68 @@
1
+ package ast
2
+
3
+ func NonNullNamedType(named string, pos *Position) *Type {
4
+ return &Type{NamedType: named, NonNull: true, Position: pos}
5
+ }
6
+
7
+ func NamedType(named string, pos *Position) *Type {
8
+ return &Type{NamedType: named, NonNull: false, Position: pos}
9
+ }
10
+
11
+ func NonNullListType(elem *Type, pos *Position) *Type {
12
+ return &Type{Elem: elem, NonNull: true, Position: pos}
13
+ }
14
+
15
+ func ListType(elem *Type, pos *Position) *Type {
16
+ return &Type{Elem: elem, NonNull: false, Position: pos}
17
+ }
18
+
19
+ type Type struct {
20
+ NamedType string
21
+ Elem *Type
22
+ NonNull bool
23
+ Position *Position `dump:"-" json:"-"`
24
+ }
25
+
26
+ func (t *Type) Name() string {
27
+ if t.NamedType != "" {
28
+ return t.NamedType
29
+ }
30
+
31
+ return t.Elem.Name()
32
+ }
33
+
34
+ func (t *Type) String() string {
35
+ nn := ""
36
+ if t.NonNull {
37
+ nn = "!"
38
+ }
39
+ if t.NamedType != "" {
40
+ return t.NamedType + nn
41
+ }
42
+
43
+ return "[" + t.Elem.String() + "]" + nn
44
+ }
45
+
46
+ func (t *Type) IsCompatible(other *Type) bool {
47
+ if t.NamedType != other.NamedType {
48
+ return false
49
+ }
50
+
51
+ if t.Elem != nil && other.Elem == nil {
52
+ return false
53
+ }
54
+
55
+ if t.Elem != nil && !t.Elem.IsCompatible(other.Elem) {
56
+ return false
57
+ }
58
+
59
+ if other.NonNull {
60
+ return t.NonNull
61
+ }
62
+
63
+ return true
64
+ }
65
+
66
+ func (t *Type) Dump() string {
67
+ return t.String()
68
+ }
@@ -0,0 +1,122 @@
1
+ package ast
2
+
3
+ import (
4
+ "fmt"
5
+ "strconv"
6
+ "strings"
7
+ )
8
+
9
+ type ValueKind int
10
+
11
+ const (
12
+ Variable ValueKind = iota
13
+ IntValue
14
+ FloatValue
15
+ StringValue
16
+ BlockValue
17
+ BooleanValue
18
+ NullValue
19
+ EnumValue
20
+ ListValue
21
+ ObjectValue
22
+ )
23
+
24
+ type Value struct {
25
+ Raw string
26
+ Children ChildValueList
27
+ Kind ValueKind
28
+ Position *Position `dump:"-" json:"-"`
29
+ Comment *CommentGroup
30
+
31
+ // Require validation
32
+ Definition *Definition
33
+ VariableDefinition *VariableDefinition
34
+ ExpectedType *Type
35
+ }
36
+
37
+ type ChildValue struct {
38
+ Name string
39
+ Value *Value
40
+ Position *Position `dump:"-" json:"-"`
41
+ Comment *CommentGroup
42
+ }
43
+
44
+ func (v *Value) Value(vars map[string]interface{}) (interface{}, error) {
45
+ if v == nil {
46
+ return nil, nil
47
+ }
48
+ switch v.Kind {
49
+ case Variable:
50
+ if value, ok := vars[v.Raw]; ok {
51
+ return value, nil
52
+ }
53
+ if v.VariableDefinition != nil && v.VariableDefinition.DefaultValue != nil {
54
+ return v.VariableDefinition.DefaultValue.Value(vars)
55
+ }
56
+ return nil, nil
57
+ case IntValue:
58
+ return strconv.ParseInt(v.Raw, 10, 64)
59
+ case FloatValue:
60
+ return strconv.ParseFloat(v.Raw, 64)
61
+ case StringValue, BlockValue, EnumValue:
62
+ return v.Raw, nil
63
+ case BooleanValue:
64
+ return strconv.ParseBool(v.Raw)
65
+ case NullValue:
66
+ return nil, nil
67
+ case ListValue:
68
+ var val []interface{}
69
+ for _, elem := range v.Children {
70
+ elemVal, err := elem.Value.Value(vars)
71
+ if err != nil {
72
+ return val, err
73
+ }
74
+ val = append(val, elemVal)
75
+ }
76
+ return val, nil
77
+ case ObjectValue:
78
+ val := map[string]interface{}{}
79
+ for _, elem := range v.Children {
80
+ elemVal, err := elem.Value.Value(vars)
81
+ if err != nil {
82
+ return val, err
83
+ }
84
+ val[elem.Name] = elemVal
85
+ }
86
+ return val, nil
87
+ default:
88
+ panic(fmt.Errorf("unknown value kind %d", v.Kind))
89
+ }
90
+ }
91
+
92
+ func (v *Value) String() string {
93
+ if v == nil {
94
+ return "<nil>"
95
+ }
96
+ switch v.Kind {
97
+ case Variable:
98
+ return "$" + v.Raw
99
+ case IntValue, FloatValue, EnumValue, BooleanValue, NullValue:
100
+ return v.Raw
101
+ case StringValue, BlockValue:
102
+ return strconv.Quote(v.Raw)
103
+ case ListValue:
104
+ var val []string
105
+ for _, elem := range v.Children {
106
+ val = append(val, elem.Value.String())
107
+ }
108
+ return "[" + strings.Join(val, ",") + "]"
109
+ case ObjectValue:
110
+ var val []string
111
+ for _, elem := range v.Children {
112
+ val = append(val, elem.Name+":"+elem.Value.String())
113
+ }
114
+ return "{" + strings.Join(val, ",") + "}"
115
+ default:
116
+ panic(fmt.Errorf("unknown value kind %d", v.Kind))
117
+ }
118
+ }
119
+
120
+ func (v *Value) Dump() string {
121
+ return v.String()
122
+ }
@@ -6,21 +6,29 @@
6
6
 
7
7
  package exhttp
8
8
 
9
- import "net/http"
9
+ import (
10
+ "bufio"
11
+ "encoding/json"
12
+ "fmt"
13
+ "net"
14
+ "net/http"
15
+ )
10
16
 
11
- type ErrorBodyGenerators struct {
12
- NotFound func() []byte
13
- MethodNotAllowed func() []byte
17
+ type ErrorBodies struct {
18
+ NotFound json.RawMessage
19
+ MethodNotAllowed json.RawMessage
14
20
  }
15
21
 
16
- func HandleErrors(next http.Handler, gen ErrorBodyGenerators) http.Handler {
17
- return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
18
- next.ServeHTTP(&bodyOverrider{
19
- ResponseWriter: w,
20
- statusNotFoundBodyGenerator: gen.NotFound,
21
- statusMethodNotAllowedBodyGenerator: gen.MethodNotAllowed,
22
- }, r)
23
- })
22
+ func HandleErrors(gen ErrorBodies) func(http.Handler) http.Handler {
23
+ return func(next http.Handler) http.Handler {
24
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
25
+ next.ServeHTTP(&bodyOverrider{
26
+ ResponseWriter: w,
27
+ statusNotFoundBody: gen.NotFound,
28
+ statusMethodNotAllowedBody: gen.MethodNotAllowed,
29
+ }, r)
30
+ })
31
+ }
24
32
  }
25
33
 
26
34
  type bodyOverrider struct {
@@ -28,17 +36,26 @@ type bodyOverrider struct {
28
36
 
29
37
  code int
30
38
  override bool
39
+ written bool
40
+
41
+ hijacked bool
31
42
 
32
- statusNotFoundBodyGenerator func() []byte
33
- statusMethodNotAllowedBodyGenerator func() []byte
43
+ statusNotFoundBody json.RawMessage
44
+ statusMethodNotAllowedBody json.RawMessage
34
45
  }
35
46
 
36
- var _ http.ResponseWriter = (*bodyOverrider)(nil)
47
+ var (
48
+ _ http.ResponseWriter = (*bodyOverrider)(nil)
49
+ _ http.Flusher = (*bodyOverrider)(nil)
50
+ _ http.Hijacker = (*bodyOverrider)(nil)
51
+ )
37
52
 
38
53
  func (b *bodyOverrider) WriteHeader(code int) {
39
- if b.Header().Get("Content-Type") == "text/plain; charset=utf-8" {
40
- b.Header().Set("Content-Type", "application/json")
54
+ if !b.hijacked &&
55
+ b.Header().Get("Content-Type") == "text/plain; charset=utf-8" &&
56
+ (code == http.StatusNotFound || code == http.StatusMethodNotAllowed) {
41
57
 
58
+ b.Header().Set("Content-Type", "application/json")
42
59
  b.override = true
43
60
  }
44
61
 
@@ -46,19 +63,36 @@ func (b *bodyOverrider) WriteHeader(code int) {
46
63
  b.ResponseWriter.WriteHeader(code)
47
64
  }
48
65
 
49
- func (b *bodyOverrider) Write(body []byte) (int, error) {
66
+ func (b *bodyOverrider) Write(body []byte) (n int, err error) {
50
67
  if b.override {
51
- switch b.code {
52
- case http.StatusNotFound:
53
- if b.statusNotFoundBodyGenerator != nil {
54
- body = b.statusNotFoundBodyGenerator()
55
- }
56
- case http.StatusMethodNotAllowed:
57
- if b.statusMethodNotAllowedBodyGenerator != nil {
58
- body = b.statusMethodNotAllowedBodyGenerator()
68
+ n = len(body)
69
+ if !b.written {
70
+ switch b.code {
71
+ case http.StatusNotFound:
72
+ _, err = b.ResponseWriter.Write(b.statusNotFoundBody)
73
+ case http.StatusMethodNotAllowed:
74
+ _, err = b.ResponseWriter.Write(b.statusMethodNotAllowedBody)
59
75
  }
60
76
  }
77
+ b.written = true
78
+ return
61
79
  }
62
80
 
63
81
  return b.ResponseWriter.Write(body)
64
82
  }
83
+
84
+ func (b *bodyOverrider) Hijack() (net.Conn, *bufio.ReadWriter, error) {
85
+ hijacker, ok := b.ResponseWriter.(http.Hijacker)
86
+ if !ok {
87
+ return nil, nil, fmt.Errorf("HandleErrors: %T does not implement http.Hijacker", b.ResponseWriter)
88
+ }
89
+ b.hijacked = true
90
+ return hijacker.Hijack()
91
+ }
92
+
93
+ func (b *bodyOverrider) Flush() {
94
+ flusher, ok := b.ResponseWriter.(http.Flusher)
95
+ if ok {
96
+ flusher.Flush()
97
+ }
98
+ }
@@ -32,10 +32,5 @@ func WriteJSONData(w http.ResponseWriter, httpStatusCode int, data []byte) {
32
32
  }
33
33
 
34
34
  func WriteEmptyJSONResponse(w http.ResponseWriter, httpStatusCode int) {
35
- if AutoAllowCORS {
36
- AddCORSHeaders(w)
37
- }
38
- w.Header().Set("Content-Type", "application/json")
39
- w.WriteHeader(httpStatusCode)
40
- _, _ = w.Write([]byte("{}"))
35
+ WriteJSONData(w, httpStatusCode, []byte("{}"))
41
36
  }
@@ -26,7 +26,8 @@ func IsNetworkError(err error) bool {
26
26
  errno == syscall.ETIMEDOUT ||
27
27
  errno == syscall.ECONNREFUSED ||
28
28
  errno == syscall.EHOSTDOWN ||
29
- errno == syscall.EHOSTUNREACH
29
+ errno == syscall.EHOSTUNREACH ||
30
+ errno == syscall.EPIPE
30
31
  } else if netError := net.Error(nil); errors.As(err, &netError) {
31
32
  return true
32
33
  } else if errors.As(err, &http2.StreamError{}) {
@@ -0,0 +1,104 @@
1
+ // Copyright (c) 2025 Tulir Asokan
2
+ //
3
+ // This Source Code Form is subject to the terms of the Mozilla Public
4
+ // License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
+
7
+ package exstrings
8
+
9
+ import (
10
+ "crypto/sha256"
11
+ "crypto/subtle"
12
+ "strings"
13
+ "unsafe"
14
+ )
15
+
16
+ // UnsafeBytes returns a byte slice that points to the same memory as the input string.
17
+ //
18
+ // The returned byte slice must not be modified.
19
+ //
20
+ // See [go.mau.fi/util/exbytes.UnsafeString] for the reverse operation.
21
+ func UnsafeBytes(str string) []byte {
22
+ return unsafe.Slice(unsafe.StringData(str), len(str))
23
+ }
24
+
25
+ // SHA256 returns the SHA-256 hash of the input string without copying the string.
26
+ func SHA256(str string) [32]byte {
27
+ return sha256.Sum256(UnsafeBytes(str))
28
+ }
29
+
30
+ // ConstantTimeEqual compares two strings using [subtle.ConstantTimeCompare] without copying the strings.
31
+ //
32
+ // Note that ConstantTimeCompare is not constant time if the strings are of different length.
33
+ func ConstantTimeEqual(a, b string) bool {
34
+ return subtle.ConstantTimeCompare(UnsafeBytes(a), UnsafeBytes(b)) == 1
35
+ }
36
+
37
+ // LongestSequenceOf returns the length of the longest contiguous sequence of a single rune in a string.
38
+ func LongestSequenceOf(a string, b rune) int {
39
+ // IndexRune has some optimizations, so use it to find the starting point
40
+ firstIndex := strings.IndexRune(a, b)
41
+ if firstIndex == -1 {
42
+ return 0
43
+ }
44
+ count := 0
45
+ maxCount := 0
46
+ for _, r := range a[firstIndex:] {
47
+ if r == b {
48
+ count++
49
+ if count > maxCount {
50
+ maxCount = count
51
+ }
52
+ } else {
53
+ count = 0
54
+ }
55
+ }
56
+ return maxCount
57
+ }
58
+
59
+ // PrefixByteRunLength returns the number of the given byte at the start of a string.
60
+ func PrefixByteRunLength(s string, b byte) int {
61
+ count := 0
62
+ for ; count < len(s) && s[count] == b; count++ {
63
+ }
64
+ return count
65
+ }
66
+
67
+ // CollapseSpaces replaces all runs of multiple spaces (\x20) in a string with a single space.
68
+ func CollapseSpaces(s string) string {
69
+ doubleSpaceIdx := strings.Index(s, " ")
70
+ if doubleSpaceIdx < 0 {
71
+ return s
72
+ }
73
+ var buf strings.Builder
74
+ buf.Grow(len(s))
75
+ for doubleSpaceIdx >= 0 {
76
+ buf.WriteString(s[:doubleSpaceIdx+1])
77
+ spaceCount := PrefixByteRunLength(s[doubleSpaceIdx+2:], ' ') + 2
78
+ s = s[doubleSpaceIdx+spaceCount:]
79
+ doubleSpaceIdx = strings.Index(s, " ")
80
+ }
81
+ buf.WriteString(s)
82
+ return buf.String()
83
+ }
84
+
85
+ // LongestSequenceOfFunc returns the length of the longest contiguous sequence of runes in a string.
86
+ //
87
+ // If the provided function returns zero or higher, the return value is added to the current count.
88
+ // If the return value is negative, the count is reset to zero.
89
+ func LongestSequenceOfFunc(a string, fn func(b rune) int) int {
90
+ count := 0
91
+ maxCount := 0
92
+ for _, r := range a {
93
+ val := fn(r)
94
+ if val < 0 {
95
+ count = 0
96
+ } else {
97
+ count += val
98
+ if count > maxCount {
99
+ maxCount = count
100
+ }
101
+ }
102
+ }
103
+ return maxCount
104
+ }
@@ -16,9 +16,10 @@ import (
16
16
  //
17
17
  // It's modelled after Python's asyncio.Event: https://docs.python.org/3/library/asyncio-sync.html#asyncio.Event
18
18
  type Event struct {
19
- ch chan empty
20
- set bool
21
- l sync.RWMutex
19
+ ch chan empty
20
+ set bool
21
+ waiting bool
22
+ l sync.RWMutex
22
23
  }
23
24
 
24
25
  // NewEvent creates a new event. It will initially be unset.
@@ -34,6 +35,7 @@ type EventChan = <-chan empty
34
35
  func (e *Event) GetChan() EventChan {
35
36
  e.l.RLock()
36
37
  defer e.l.RUnlock()
38
+ e.waiting = true
37
39
  return e.ch
38
40
  }
39
41
 
@@ -76,6 +78,19 @@ func (e *Event) Set() {
76
78
  }
77
79
  }
78
80
 
81
+ // Notify notifies all waiters, but doesn't set the event.
82
+ //
83
+ // Calling Notify when the event is already set is a no-op.
84
+ func (e *Event) Notify() {
85
+ e.l.Lock()
86
+ defer e.l.Unlock()
87
+ if !e.set && e.waiting {
88
+ close(e.ch)
89
+ e.ch = make(chan empty)
90
+ e.waiting = false
91
+ }
92
+ }
93
+
79
94
  // Clear clears the event, making it unset. Future calls to Wait will now block until Set is called again.
80
95
  // If the event is not already set, this is a no-op and existing calls to Wait will keep working.
81
96
  func (e *Event) Clear() {
@@ -84,5 +99,6 @@ func (e *Event) Clear() {
84
99
  if e.set {
85
100
  e.ch = make(chan empty)
86
101
  e.set = false
102
+ e.waiting = false
87
103
  }
88
104
  }
@@ -1,6 +1,6 @@
1
1
  repos:
2
2
  - repo: https://github.com/pre-commit/pre-commit-hooks
3
- rev: v5.0.0
3
+ rev: v6.0.0
4
4
  hooks:
5
5
  - id: trailing-whitespace
6
6
  exclude_types: [markdown]
@@ -11,7 +11,7 @@ repos:
11
11
  - id: check-added-large-files
12
12
 
13
13
  - repo: https://github.com/tekwizely/pre-commit-golang
14
- rev: v1.0.0-rc.1
14
+ rev: v1.0.0-rc.2
15
15
  hooks:
16
16
  - id: go-imports-repo
17
17
  args:
@@ -24,7 +24,7 @@ repos:
24
24
  - id: go-mod-tidy
25
25
 
26
26
  - repo: https://github.com/beeper/pre-commit-go
27
- rev: v0.3.1
27
+ rev: v0.4.2
28
28
  hooks:
29
29
  # TODO enable this
30
30
  #- id: zerolog-ban-msgf
@@ -288,7 +288,7 @@ func (proc *Processor) DecodePatches(ctx context.Context, list *PatchList, initi
288
288
 
289
289
  if validateMACs {
290
290
  var keys ExpandedAppStateKeys
291
- keys, err = proc.validateSnapshotMAC(ctx, list.Name, currentState, patch.GetKeyID().GetID(), patch.GetSnapshotMac())
291
+ keys, err = proc.validateSnapshotMAC(ctx, list.Name, currentState, patch.GetKeyID().GetID(), patch.GetSnapshotMAC())
292
292
  if err != nil {
293
293
  return
294
294
  }
@@ -80,7 +80,7 @@ func (hs *HashState) generateSnapshotMAC(name WAPatchName, key []byte) []byte {
80
80
 
81
81
  func generatePatchMAC(patch *waServerSync.SyncdPatch, name WAPatchName, key []byte, version uint64) []byte {
82
82
  dataToHash := make([][]byte, len(patch.GetMutations())+3)
83
- dataToHash[0] = patch.GetSnapshotMac()
83
+ dataToHash[0] = patch.GetSnapshotMAC()
84
84
  for i, mutation := range patch.Mutations {
85
85
  val := mutation.GetRecord().GetValue().GetBlob()
86
86
  dataToHash[i+1] = val[len(val)-32:]
@@ -134,7 +134,11 @@ func (cli *Client) dispatchAppState(ctx context.Context, mutation appstate.Mutat
134
134
  eventToDispatch = &events.Mute{JID: jid, Timestamp: ts, Action: act, FromFullSync: fullSync}
135
135
  var mutedUntil time.Time
136
136
  if act.GetMuted() {
137
- mutedUntil = time.UnixMilli(act.GetMuteEndTimestamp())
137
+ if act.GetMuteEndTimestamp() < 0 {
138
+ mutedUntil = store.MutedForever
139
+ } else {
140
+ mutedUntil = time.UnixMilli(act.GetMuteEndTimestamp())
141
+ }
138
142
  }
139
143
  if cli.Store.ChatSettings != nil {
140
144
  storeUpdateError = cli.Store.ChatSettings.PutMutedUntil(ctx, jid, mutedUntil)