slidge-whatsapp 0.3.0b0__cp311-cp311-manylinux_2_36_aarch64.whl → 0.3.4__cp311-cp311-manylinux_2_36_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (167) hide show
  1. slidge_whatsapp/contact.py +2 -0
  2. slidge_whatsapp/event.go +72 -22
  3. slidge_whatsapp/generated/_whatsapp.cpython-311-aarch64-linux-gnu.h +199 -199
  4. slidge_whatsapp/generated/_whatsapp.cpython-311-aarch64-linux-gnu.so +0 -0
  5. slidge_whatsapp/generated/build.py +156 -156
  6. slidge_whatsapp/generated/go.py +1 -1
  7. slidge_whatsapp/generated/whatsapp.c +1543 -1543
  8. slidge_whatsapp/generated/whatsapp.go +1203 -1203
  9. slidge_whatsapp/generated/whatsapp.py +1377 -1377
  10. slidge_whatsapp/generated/whatsapp_go.h +199 -199
  11. slidge_whatsapp/go.mod +11 -11
  12. slidge_whatsapp/go.sum +26 -26
  13. slidge_whatsapp/session.go +4 -4
  14. slidge_whatsapp/vendor/github.com/ebitengine/purego/README.md +21 -5
  15. slidge_whatsapp/vendor/github.com/ebitengine/purego/abi_loong64.h +60 -0
  16. slidge_whatsapp/vendor/github.com/ebitengine/purego/cgo.go +1 -1
  17. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlerror.go +1 -1
  18. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn.go +1 -1
  19. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_netbsd.go +15 -0
  20. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_nocgo_netbsd.go +9 -0
  21. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_stubs.s +1 -1
  22. slidge_whatsapp/vendor/github.com/ebitengine/purego/func.go +113 -60
  23. slidge_whatsapp/vendor/github.com/ebitengine/purego/gen.go +6 -0
  24. slidge_whatsapp/vendor/github.com/ebitengine/purego/go_runtime.go +1 -1
  25. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go +2 -2
  26. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go +2 -2
  27. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h +60 -0
  28. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s +40 -0
  29. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go +1 -1
  30. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go +1 -1
  31. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +1 -1
  32. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_loong64.go +92 -0
  33. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go +106 -0
  34. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go +1 -1
  35. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go +1 -1
  36. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go +1 -1
  37. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go +1 -1
  38. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go +4 -0
  39. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go +4 -0
  40. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go +4 -0
  41. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go +26 -0
  42. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go +23 -0
  43. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go +1 -1
  44. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +11 -1
  45. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go +1 -0
  46. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go +1 -0
  47. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go +1 -0
  48. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_netbsd.go +30 -0
  49. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s +71 -0
  50. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s +5 -1
  51. slidge_whatsapp/vendor/github.com/ebitengine/purego/nocgo.go +1 -1
  52. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_amd64.go +8 -4
  53. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_arm64.go +16 -6
  54. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_loong64.go +190 -0
  55. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_other.go +6 -2
  56. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_amd64.s +1 -1
  57. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_arm64.s +1 -1
  58. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_loong64.s +96 -0
  59. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_arm64.s +1 -1
  60. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_loong64.s +75 -0
  61. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall.go +6 -3
  62. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go +3 -3
  63. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_sysv.go +13 -10
  64. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_windows.go +1 -1
  65. slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_amd64.s +2002 -2002
  66. slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_arm64.s +4002 -4002
  67. slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_loong64.s +4014 -0
  68. slidge_whatsapp/vendor/go.mau.fi/libsignal/session/SessionCipher.go +7 -2
  69. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/log.go +1 -0
  70. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/module.go +119 -0
  71. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgradetable.go +3 -34
  72. slidge_whatsapp/vendor/go.mau.fi/util/exbytes/string.go +20 -0
  73. slidge_whatsapp/vendor/go.mau.fi/util/exbytes/writer.go +78 -0
  74. slidge_whatsapp/vendor/go.mau.fi/util/exslices/cast.go +42 -0
  75. slidge_whatsapp/vendor/go.mau.fi/util/exslices/chunk.go +28 -0
  76. slidge_whatsapp/vendor/go.mau.fi/util/exslices/deduplicate.go +67 -0
  77. slidge_whatsapp/vendor/go.mau.fi/util/exslices/diff.go +63 -0
  78. slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +15 -1
  79. slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncmap.go +48 -7
  80. slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncset.go +13 -0
  81. slidge_whatsapp/vendor/go.mau.fi/util/jsontime/helpers.go +16 -5
  82. slidge_whatsapp/vendor/go.mau.fi/util/jsontime/integer.go +27 -12
  83. slidge_whatsapp/vendor/go.mau.fi/util/random/string.go +47 -7
  84. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -0
  85. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +60 -15
  86. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -0
  87. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +20 -2
  88. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +2 -2
  89. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +6 -0
  90. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +1 -0
  91. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +63 -42
  92. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +31 -15
  93. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +77 -26
  94. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +23 -0
  95. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +5 -1
  96. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +22 -23
  97. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +21 -0
  98. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.pb.go +7747 -0
  99. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/{waBotMetadata/WABotMetadata.proto → waAICommon/WAAICommon.proto} +269 -9
  100. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +128 -14
  101. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +10 -0
  102. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +8953 -10087
  103. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +216 -330
  104. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +11 -2
  105. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +1 -0
  106. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +226 -83
  107. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +14 -0
  108. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +709 -449
  109. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +24 -0
  110. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +78 -24
  111. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +6 -0
  112. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +528 -267
  113. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +24 -0
  114. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +47 -14
  115. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/request.go +4 -0
  116. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +6 -13
  117. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +130 -62
  118. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +33 -32
  119. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
  120. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +16 -0
  121. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sessioncache.go +125 -0
  122. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/signal.go +8 -0
  123. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/lidmap.go +82 -4
  124. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +135 -55
  125. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +8 -7
  126. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/11-redacted-phone-contacts.sql +2 -0
  127. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +24 -2
  128. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +6 -5
  129. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +24 -9
  130. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +7 -1
  131. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +3 -0
  132. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +43 -3
  133. slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +7 -4
  134. slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +11 -6
  135. slidge_whatsapp/vendor/golang.org/x/net/http2/config_go125.go +15 -0
  136. slidge_whatsapp/vendor/golang.org/x/net/http2/config_go126.go +15 -0
  137. slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +24 -1
  138. slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +0 -1
  139. slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +35 -26
  140. slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +4 -2
  141. slidge_whatsapp/vendor/golang.org/x/net/http2/writesched.go +2 -0
  142. slidge_whatsapp/vendor/golang.org/x/net/http2/{writesched_priority.go → writesched_priority_rfc7540.go} +52 -52
  143. slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_priority_rfc9128.go +209 -0
  144. slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_roundrobin.go +1 -1
  145. slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/request.go +2 -2
  146. slidge_whatsapp/vendor/golang.org/x/net/internal/socks/socks.go +1 -1
  147. slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +9 -0
  148. slidge_whatsapp/vendor/golang.org/x/sys/unix/fdset.go +1 -3
  149. slidge_whatsapp/vendor/golang.org/x/sys/unix/ifreq_linux.go +1 -3
  150. slidge_whatsapp/vendor/golang.org/x/sys/unix/mkall.sh +1 -0
  151. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +1 -3
  152. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_netbsd.go +17 -0
  153. slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +2 -0
  154. slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +16 -0
  155. slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +18 -0
  156. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/core.go +2 -9
  157. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +35 -17
  158. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +14 -0
  159. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +20 -0
  160. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
  161. slidge_whatsapp/vendor/modules.txt +15 -13
  162. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/METADATA +4 -3
  163. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/RECORD +166 -138
  164. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/WHEEL +1 -1
  165. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +0 -5156
  166. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info}/entry_points.txt +0 -0
  167. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.4.dist-info/licenses}/LICENSE +0 -0
@@ -29,6 +29,7 @@ const (
29
29
  InteropServer = "interop"
30
30
  NewsletterServer = "newsletter"
31
31
  HostedServer = "hosted"
32
+ HostedLIDServer = "hosted.lid"
32
33
  BotServer = "bot"
33
34
  )
34
35
 
@@ -46,6 +47,13 @@ var (
46
47
  NewMetaAIJID = NewJID("867051314767696", BotServer)
47
48
  )
48
49
 
50
+ var (
51
+ WhatsAppDomain = uint8(0) // This is the main domain type that whatsapp uses
52
+ LIDDomain = uint8(1) // This is the domain for LID type JIDs
53
+ HostedDomain = uint8(128) // This is the domain for Hosted type JIDs
54
+ HostedLIDDomain = uint8(129) // This is the domain for Hosted LID type JIDs
55
+ )
56
+
49
57
  // MessageID is the internal ID of a WhatsApp message.
50
58
  type MessageID = string
51
59
 
@@ -68,9 +76,13 @@ type JID struct {
68
76
  func (jid JID) ActualAgent() uint8 {
69
77
  switch jid.Server {
70
78
  case DefaultUserServer:
71
- return 0
79
+ return WhatsAppDomain
72
80
  case HiddenUserServer:
73
- return 1
81
+ return LIDDomain
82
+ case HostedServer:
83
+ return HostedDomain
84
+ case HostedLIDServer:
85
+ return HostedLIDDomain
74
86
  default:
75
87
  return jid.RawAgent
76
88
  }
@@ -119,17 +131,20 @@ func (jid JID) IsBot() bool {
119
131
  // NewADJID creates a new AD JID.
120
132
  func NewADJID(user string, agent, device uint8) JID {
121
133
  var server string
134
+ // agent terminology isn't 100% correct here, these are the domainType, but whatsapp usually places them in the same place (if the switch case below doesn't process it, then it is an agent instead)
122
135
  switch agent {
123
- case 0:
124
- server = DefaultUserServer
125
- case 1:
136
+ case LIDDomain:
126
137
  server = HiddenUserServer
127
138
  agent = 0
128
- default:
129
- if (agent&0x01) != 0 || (agent&0x80) == 0 { // agent % 2 == 0 || agent < 128?
130
- // TODO invalid JID?
131
- }
139
+ case HostedDomain:
132
140
  server = HostedServer
141
+ agent = 0
142
+ case HostedLIDDomain:
143
+ server = HostedLIDServer
144
+ agent = 0
145
+ default:
146
+ case WhatsAppDomain:
147
+ server = DefaultUserServer // will just default to the normal server
133
148
  }
134
149
  return JID{
135
150
  User: user,
@@ -18,6 +18,11 @@ const (
18
18
  AddressingModeLID AddressingMode = "lid"
19
19
  )
20
20
 
21
+ type BroadcastRecipient struct {
22
+ LID JID
23
+ PN JID
24
+ }
25
+
21
26
  // MessageSource contains basic sender and chat information about a message.
22
27
  type MessageSource struct {
23
28
  Chat JID // The chat where the message was sent.
@@ -31,7 +36,8 @@ type MessageSource struct {
31
36
 
32
37
  // When sending a read receipt to a broadcast list message, the Chat is the broadcast list
33
38
  // and Sender is you, so this field contains the recipient of the read receipt.
34
- BroadcastListOwner JID
39
+ BroadcastListOwner JID
40
+ BroadcastRecipients []BroadcastRecipient
35
41
  }
36
42
 
37
43
  // IsIncomingBroadcast returns true if the message was sent to a broadcast list instead of directly to the user.
@@ -24,6 +24,7 @@ type UserInfo struct {
24
24
  Status string
25
25
  PictureID string
26
26
  Devices []JID
27
+ LID JID
27
28
  }
28
29
 
29
30
  type BotListInfo struct {
@@ -68,6 +69,8 @@ type ContactInfo struct {
68
69
  FullName string
69
70
  PushName string
70
71
  BusinessName string
72
+ // Only for LID members encountered in groups, the phone number in the form "+1∙∙∙∙∙∙∙∙80"
73
+ RedactedPhone string
71
74
  }
72
75
 
73
76
  // LocalChatSettings contains the cached local settings for a chat.
@@ -19,6 +19,7 @@ import (
19
19
  waBinary "go.mau.fi/whatsmeow/binary"
20
20
  "go.mau.fi/whatsmeow/proto/waHistorySync"
21
21
  "go.mau.fi/whatsmeow/proto/waVnameCert"
22
+ "go.mau.fi/whatsmeow/store"
22
23
  "go.mau.fi/whatsmeow/types"
23
24
  "go.mau.fi/whatsmeow/types/events"
24
25
  )
@@ -205,11 +206,13 @@ func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo,
205
206
  {Tag: "status"},
206
207
  {Tag: "picture"},
207
208
  {Tag: "devices", Attrs: waBinary.Attrs{"version": "2"}},
209
+ {Tag: "lid"},
208
210
  })
209
211
  if err != nil {
210
212
  return nil, err
211
213
  }
212
214
  respData := make(map[types.JID]types.UserInfo, len(jids))
215
+ mappings := make([]store.LIDMapping, 0, len(jids))
213
216
  for _, child := range list.GetChildren() {
214
217
  jid, jidOK := child.Attrs["jid"].(types.JID)
215
218
  if child.Tag != "user" || !jidOK {
@@ -224,11 +227,26 @@ func (cli *Client) GetUserInfo(jids []types.JID) (map[types.JID]types.UserInfo,
224
227
  info.Status = string(status)
225
228
  info.PictureID, _ = child.GetChildByTag("picture").Attrs["id"].(string)
226
229
  info.Devices = parseDeviceList(jid, child.GetChildByTag("devices"))
230
+
231
+ lidTag := child.GetChildByTag("lid")
232
+ info.LID = lidTag.AttrGetter().OptionalJIDOrEmpty("val")
233
+
234
+ if !info.LID.IsEmpty() {
235
+ mappings = append(mappings, store.LIDMapping{PN: jid, LID: info.LID})
236
+ }
237
+
227
238
  if verifiedName != nil {
228
239
  cli.updateBusinessName(context.TODO(), jid, nil, verifiedName.Details.GetVerifiedName())
229
240
  }
230
241
  respData[jid] = info
231
242
  }
243
+
244
+ err = cli.Store.LIDs.PutManyLIDMappings(context.TODO(), mappings)
245
+ if err != nil {
246
+ // not worth returning on the error, instead just post a log
247
+ cli.Log.Errorf("Failed to place LID mappings from USync call")
248
+ }
249
+
232
250
  return respData, nil
233
251
  }
234
252
 
@@ -527,9 +545,18 @@ func (cli *Client) GetProfilePictureInfo(jid types.JID, params *GetProfilePictur
527
545
  } else {
528
546
  to = types.ServerJID
529
547
  target = jid
548
+ var pictureContent []waBinary.Node
549
+ if token, _ := cli.Store.PrivacyTokens.GetPrivacyToken(context.TODO(), jid); token != nil {
550
+ pictureContent = []waBinary.Node{{
551
+ Tag: "tctoken",
552
+ Content: token.Token,
553
+ }}
554
+ }
555
+
530
556
  content = []waBinary.Node{{
531
- Tag: "picture",
532
- Attrs: attrs,
557
+ Tag: "picture",
558
+ Attrs: attrs,
559
+ Content: pictureContent,
533
560
  }}
534
561
  }
535
562
  resp, err := cli.sendIQ(infoQuery{
@@ -677,11 +704,22 @@ func parseDeviceList(user types.JID, deviceNode waBinary.Node) []types.JID {
677
704
  devices := make([]types.JID, 0, len(children))
678
705
  for _, device := range children {
679
706
  deviceID, ok := device.AttrGetter().GetInt64("id", true)
707
+ isHosted := device.AttrGetter().Bool("is_hosted")
680
708
  if device.Tag != "device" || !ok {
681
709
  continue
682
710
  }
683
711
  user.Device = uint16(deviceID)
684
- devices = append(devices, user)
712
+ if isHosted {
713
+ hostedUser := user
714
+ if user.Server == types.HiddenUserServer {
715
+ hostedUser.Server = types.HostedLIDServer
716
+ } else {
717
+ hostedUser.Server = types.HostedServer
718
+ }
719
+ devices = append(devices, hostedUser)
720
+ } else {
721
+ devices = append(devices, user)
722
+ }
685
723
  }
686
724
  return devices
687
725
  }
@@ -778,6 +816,8 @@ func (cli *Client) usync(ctx context.Context, jids []types.JID, mode, context st
778
816
  Content: jid.String(),
779
817
  }}
780
818
  case types.DefaultUserServer, types.HiddenUserServer:
819
+ // NOTE: You can pass in an LID with a JID (<lid jid=...> user node)
820
+ // Not sure if you can just put the LID in the jid tag here (works for <devices> queries mainly)
781
821
  userList[i].Attrs = waBinary.Attrs{"jid": jid}
782
822
  if jid.IsBot() {
783
823
  var personaID string
@@ -3,11 +3,14 @@
3
3
  // license that can be found in the LICENSE file.
4
4
 
5
5
  // Package curve25519 provides an implementation of the X25519 function, which
6
- // performs scalar multiplication on the elliptic curve known as Curve25519.
7
- // See RFC 7748.
6
+ // performs scalar multiplication on the elliptic curve known as Curve25519
7
+ // according to [RFC 7748].
8
8
  //
9
- // This package is a wrapper for the X25519 implementation
10
- // in the crypto/ecdh package.
9
+ // The curve25519 package is a wrapper for the X25519 implementation in the
10
+ // crypto/ecdh package. It is [frozen] and is not accepting new features.
11
+ //
12
+ // [RFC 7748]: https://datatracker.ietf.org/doc/html/rfc7748
13
+ // [frozen]: https://go.dev/wiki/Frozen
11
14
  package curve25519
12
15
 
13
16
  import "crypto/ecdh"
@@ -27,6 +27,7 @@ import (
27
27
  // - If the resulting value is zero or out of range, use a default.
28
28
  type http2Config struct {
29
29
  MaxConcurrentStreams uint32
30
+ StrictMaxConcurrentRequests bool
30
31
  MaxDecoderHeaderTableSize uint32
31
32
  MaxEncoderHeaderTableSize uint32
32
33
  MaxReadFrameSize uint32
@@ -64,12 +65,13 @@ func configFromServer(h1 *http.Server, h2 *Server) http2Config {
64
65
  // (the net/http Transport).
65
66
  func configFromTransport(h2 *Transport) http2Config {
66
67
  conf := http2Config{
67
- MaxEncoderHeaderTableSize: h2.MaxEncoderHeaderTableSize,
68
- MaxDecoderHeaderTableSize: h2.MaxDecoderHeaderTableSize,
69
- MaxReadFrameSize: h2.MaxReadFrameSize,
70
- SendPingTimeout: h2.ReadIdleTimeout,
71
- PingTimeout: h2.PingTimeout,
72
- WriteByteTimeout: h2.WriteByteTimeout,
68
+ StrictMaxConcurrentRequests: h2.StrictMaxConcurrentStreams,
69
+ MaxEncoderHeaderTableSize: h2.MaxEncoderHeaderTableSize,
70
+ MaxDecoderHeaderTableSize: h2.MaxDecoderHeaderTableSize,
71
+ MaxReadFrameSize: h2.MaxReadFrameSize,
72
+ SendPingTimeout: h2.ReadIdleTimeout,
73
+ PingTimeout: h2.PingTimeout,
74
+ WriteByteTimeout: h2.WriteByteTimeout,
73
75
  }
74
76
 
75
77
  // Unlike most config fields, where out-of-range values revert to the default,
@@ -128,6 +130,9 @@ func fillNetHTTPConfig(conf *http2Config, h2 *http.HTTP2Config) {
128
130
  if h2.MaxConcurrentStreams != 0 {
129
131
  conf.MaxConcurrentStreams = uint32(h2.MaxConcurrentStreams)
130
132
  }
133
+ if http2ConfigStrictMaxConcurrentRequests(h2) {
134
+ conf.StrictMaxConcurrentRequests = true
135
+ }
131
136
  if h2.MaxEncoderHeaderTableSize != 0 {
132
137
  conf.MaxEncoderHeaderTableSize = uint32(h2.MaxEncoderHeaderTableSize)
133
138
  }
@@ -0,0 +1,15 @@
1
+ // Copyright 2025 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ //go:build !go1.26
6
+
7
+ package http2
8
+
9
+ import (
10
+ "net/http"
11
+ )
12
+
13
+ func http2ConfigStrictMaxConcurrentRequests(h2 *http.HTTP2Config) bool {
14
+ return false
15
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright 2025 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ //go:build go1.26
6
+
7
+ package http2
8
+
9
+ import (
10
+ "net/http"
11
+ )
12
+
13
+ func http2ConfigStrictMaxConcurrentRequests(h2 *http.HTTP2Config) bool {
14
+ return h2.StrictMaxConcurrentRequests
15
+ }
@@ -347,7 +347,7 @@ func (fr *Framer) maxHeaderListSize() uint32 {
347
347
  func (f *Framer) startWrite(ftype FrameType, flags Flags, streamID uint32) {
348
348
  // Write the FrameHeader.
349
349
  f.wbuf = append(f.wbuf[:0],
350
- 0, // 3 bytes of length, filled in in endWrite
350
+ 0, // 3 bytes of length, filled in endWrite
351
351
  0,
352
352
  0,
353
353
  byte(ftype),
@@ -1152,6 +1152,15 @@ type PriorityFrame struct {
1152
1152
  PriorityParam
1153
1153
  }
1154
1154
 
1155
+ var defaultRFC9218Priority = PriorityParam{
1156
+ incremental: 0,
1157
+ urgency: 3,
1158
+ }
1159
+
1160
+ // Note that HTTP/2 has had two different prioritization schemes, and
1161
+ // PriorityParam struct below is a superset of both schemes. The exported
1162
+ // symbols are from RFC 7540 and the non-exported ones are from RFC 9218.
1163
+
1155
1164
  // PriorityParam are the stream prioritzation parameters.
1156
1165
  type PriorityParam struct {
1157
1166
  // StreamDep is a 31-bit stream identifier for the
@@ -1167,6 +1176,20 @@ type PriorityParam struct {
1167
1176
  // the spec, "Add one to the value to obtain a weight between
1168
1177
  // 1 and 256."
1169
1178
  Weight uint8
1179
+
1180
+ // "The urgency (u) parameter value is Integer (see Section 3.3.1 of
1181
+ // [STRUCTURED-FIELDS]), between 0 and 7 inclusive, in descending order of
1182
+ // priority. The default is 3."
1183
+ urgency uint8
1184
+
1185
+ // "The incremental (i) parameter value is Boolean (see Section 3.3.6 of
1186
+ // [STRUCTURED-FIELDS]). It indicates if an HTTP response can be processed
1187
+ // incrementally, i.e., provide some meaningful output as chunks of the
1188
+ // response arrive."
1189
+ //
1190
+ // We use uint8 (i.e. 0 is false, 1 is true) instead of bool so we can
1191
+ // avoid unnecessary type conversions and because either type takes 1 byte.
1192
+ incremental uint8
1170
1193
  }
1171
1194
 
1172
1195
  func (p PriorityParam) IsZero() bool {
@@ -34,7 +34,6 @@ var (
34
34
  VerboseLogs bool
35
35
  logFrameWrites bool
36
36
  logFrameReads bool
37
- inTests bool
38
37
 
39
38
  // Enabling extended CONNECT by causes browsers to attempt to use
40
39
  // WebSockets-over-HTTP/2. This results in problems when the server's websocket
@@ -181,6 +181,10 @@ type Server struct {
181
181
  type serverInternalState struct {
182
182
  mu sync.Mutex
183
183
  activeConns map[*serverConn]struct{}
184
+
185
+ // Pool of error channels. This is per-Server rather than global
186
+ // because channels can't be reused across synctest bubbles.
187
+ errChanPool sync.Pool
184
188
  }
185
189
 
186
190
  func (s *serverInternalState) registerConn(sc *serverConn) {
@@ -212,6 +216,27 @@ func (s *serverInternalState) startGracefulShutdown() {
212
216
  s.mu.Unlock()
213
217
  }
214
218
 
219
+ // Global error channel pool used for uninitialized Servers.
220
+ // We use a per-Server pool when possible to avoid using channels across synctest bubbles.
221
+ var errChanPool = sync.Pool{
222
+ New: func() any { return make(chan error, 1) },
223
+ }
224
+
225
+ func (s *serverInternalState) getErrChan() chan error {
226
+ if s == nil {
227
+ return errChanPool.Get().(chan error) // Server used without calling ConfigureServer
228
+ }
229
+ return s.errChanPool.Get().(chan error)
230
+ }
231
+
232
+ func (s *serverInternalState) putErrChan(ch chan error) {
233
+ if s == nil {
234
+ errChanPool.Put(ch) // Server used without calling ConfigureServer
235
+ return
236
+ }
237
+ s.errChanPool.Put(ch)
238
+ }
239
+
215
240
  // ConfigureServer adds HTTP/2 support to a net/http Server.
216
241
  //
217
242
  // The configuration conf may be nil.
@@ -224,7 +249,10 @@ func ConfigureServer(s *http.Server, conf *Server) error {
224
249
  if conf == nil {
225
250
  conf = new(Server)
226
251
  }
227
- conf.state = &serverInternalState{activeConns: make(map[*serverConn]struct{})}
252
+ conf.state = &serverInternalState{
253
+ activeConns: make(map[*serverConn]struct{}),
254
+ errChanPool: sync.Pool{New: func() any { return make(chan error, 1) }},
255
+ }
228
256
  if h1, h2 := s, conf; h2.IdleTimeout == 0 {
229
257
  if h1.IdleTimeout != 0 {
230
258
  h2.IdleTimeout = h1.IdleTimeout
@@ -1124,25 +1152,6 @@ func (sc *serverConn) readPreface() error {
1124
1152
  }
1125
1153
  }
1126
1154
 
1127
- var errChanPool = sync.Pool{
1128
- New: func() interface{} { return make(chan error, 1) },
1129
- }
1130
-
1131
- func getErrChan() chan error {
1132
- if inTests {
1133
- // Channels cannot be reused across synctest tests.
1134
- return make(chan error, 1)
1135
- } else {
1136
- return errChanPool.Get().(chan error)
1137
- }
1138
- }
1139
-
1140
- func putErrChan(ch chan error) {
1141
- if !inTests {
1142
- errChanPool.Put(ch)
1143
- }
1144
- }
1145
-
1146
1155
  var writeDataPool = sync.Pool{
1147
1156
  New: func() interface{} { return new(writeData) },
1148
1157
  }
@@ -1150,7 +1159,7 @@ var writeDataPool = sync.Pool{
1150
1159
  // writeDataFromHandler writes DATA response frames from a handler on
1151
1160
  // the given stream.
1152
1161
  func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStream bool) error {
1153
- ch := getErrChan()
1162
+ ch := sc.srv.state.getErrChan()
1154
1163
  writeArg := writeDataPool.Get().(*writeData)
1155
1164
  *writeArg = writeData{stream.id, data, endStream}
1156
1165
  err := sc.writeFrameFromHandler(FrameWriteRequest{
@@ -1182,7 +1191,7 @@ func (sc *serverConn) writeDataFromHandler(stream *stream, data []byte, endStrea
1182
1191
  return errStreamClosed
1183
1192
  }
1184
1193
  }
1185
- putErrChan(ch)
1194
+ sc.srv.state.putErrChan(ch)
1186
1195
  if frameWriteDone {
1187
1196
  writeDataPool.Put(writeArg)
1188
1197
  }
@@ -2436,7 +2445,7 @@ func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) erro
2436
2445
  // waiting for this frame to be written, so an http.Flush mid-handler
2437
2446
  // writes out the correct value of keys, before a handler later potentially
2438
2447
  // mutates it.
2439
- errc = getErrChan()
2448
+ errc = sc.srv.state.getErrChan()
2440
2449
  }
2441
2450
  if err := sc.writeFrameFromHandler(FrameWriteRequest{
2442
2451
  write: headerData,
@@ -2448,7 +2457,7 @@ func (sc *serverConn) writeHeaders(st *stream, headerData *writeResHeaders) erro
2448
2457
  if errc != nil {
2449
2458
  select {
2450
2459
  case err := <-errc:
2451
- putErrChan(errc)
2460
+ sc.srv.state.putErrChan(errc)
2452
2461
  return err
2453
2462
  case <-sc.doneServing:
2454
2463
  return errClientDisconnected
@@ -3129,7 +3138,7 @@ func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
3129
3138
  method: opts.Method,
3130
3139
  url: u,
3131
3140
  header: cloneHeader(opts.Header),
3132
- done: getErrChan(),
3141
+ done: sc.srv.state.getErrChan(),
3133
3142
  }
3134
3143
 
3135
3144
  select {
@@ -3146,7 +3155,7 @@ func (w *responseWriter) Push(target string, opts *http.PushOptions) error {
3146
3155
  case <-st.cw:
3147
3156
  return errStreamClosed
3148
3157
  case err := <-msg.done:
3149
- putErrChan(msg.done)
3158
+ sc.srv.state.putErrChan(msg.done)
3150
3159
  return err
3151
3160
  }
3152
3161
  }
@@ -355,6 +355,7 @@ type ClientConn struct {
355
355
  readIdleTimeout time.Duration
356
356
  pingTimeout time.Duration
357
357
  extendedConnectAllowed bool
358
+ strictMaxConcurrentStreams bool
358
359
 
359
360
  // rstStreamPingsBlocked works around an unfortunate gRPC behavior.
360
361
  // gRPC strictly limits the number of PING frames that it will receive.
@@ -784,7 +785,8 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro
784
785
  initialWindowSize: 65535, // spec default
785
786
  initialStreamRecvWindowSize: conf.MaxUploadBufferPerStream,
786
787
  maxConcurrentStreams: initialMaxConcurrentStreams, // "infinite", per spec. Use a smaller value until we have received server settings.
787
- peerMaxHeaderListSize: 0xffffffffffffffff, // "infinite", per spec. Use 2^64-1 instead.
788
+ strictMaxConcurrentStreams: conf.StrictMaxConcurrentRequests,
789
+ peerMaxHeaderListSize: 0xffffffffffffffff, // "infinite", per spec. Use 2^64-1 instead.
788
790
  streams: make(map[uint32]*clientStream),
789
791
  singleUse: singleUse,
790
792
  seenSettingsChan: make(chan struct{}),
@@ -1018,7 +1020,7 @@ func (cc *ClientConn) idleStateLocked() (st clientConnIdleState) {
1018
1020
  return
1019
1021
  }
1020
1022
  var maxConcurrentOkay bool
1021
- if cc.t.StrictMaxConcurrentStreams {
1023
+ if cc.strictMaxConcurrentStreams {
1022
1024
  // We'll tell the caller we can take a new request to
1023
1025
  // prevent the caller from dialing a new TCP
1024
1026
  // connection, but then we'll block later before
@@ -42,6 +42,8 @@ type OpenStreamOptions struct {
42
42
  // PusherID is zero if the stream was initiated by the client. Otherwise,
43
43
  // PusherID names the stream that pushed the newly opened stream.
44
44
  PusherID uint32
45
+ // priority is used to set the priority of the newly opened stream.
46
+ priority PriorityParam
45
47
  }
46
48
 
47
49
  // FrameWriteRequest is a request to write a frame.