fix(utils): strip plus prefix from user JIDs in ParseJID
Adapted from upstream PR #224 (danie1net0). Queries addressed to "+<number>@s.whatsapp.net" are never answered by WhatsApp and hang until the IQ timeout (upstream issue #223: /user/info and /user/avatar hang 75s). Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
fc35d72029
commit
c33b4d98fd
2 files changed
+10
-3
No files matched your search
+8
-1
@@ -207,7 +207,14 @@ func ParseJID(arg string) (whatsmeow_types.JID, bool) {
|
||||
return recipient, false
|
||||
}
|
||||
|
||||
if recipient.User == "" && !strings.Contains(jidString, "@broadcast") {
|
||||
// CreateJID keeps the "+" prefix for IsOnWhatsApp, but it is not part of a
|
||||
// user JID. WhatsApp does not answer queries addressed to "+<number>", so
|
||||
// they hang until the IQ timeout (upstream #223 / PR #224).
|
||||
if recipient.Server == whatsmeow_types.DefaultUserServer {
|
||||
recipient.User = strings.TrimPrefix(recipient.User, "+")
|
||||
}
|
||||
|
||||
if recipient.User == "" &&!strings.Contains(jidString, "@broadcast") {
|
||||
logger.LogError("Invalid JID. No user specified: %s", jidString)
|
||||
return recipient, false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user