sync: 0.7.2 from main (6164dced8d3ab8f9bcce9bf333fb4e8663760ff1)

This commit is contained in:
github-actions[bot] committed 2026-07-03 01:55:33 +00:00
1 parent 0f9ef308d2
commit 9337afc47e
74 files changed
+11173 -4687

No files matched your search

+15
View File
@@ -215,6 +215,21 @@ func ParseJID(arg string) (whatsmeow_types.JID, bool) {
return recipient, true
}
// CanonicalJID returns a JID safe for RAW protocol nodes (chatstate / typing,
// read receipts, presence subscribe, reactions, etc.).
//
// CreateJID intentionally prefixes phone numbers with "+" (e.g.
// "[email protected]") to match the IsOnWhatsApp/display convention.
// Message sending tolerates this because whatsmeow normalizes the JID during
// usync/device resolution. RAW nodes are sent WITHOUT usync, so a malformed
// "+JID" reaches the server and the node is silently dropped (e.g. the "typing"
// indicator never reaches the recipient). WhatsApp user JIDs are digits-only, so
// strip the leading "+" to get the canonical form.
func CanonicalJID(jid whatsmeow_types.JID) whatsmeow_types.JID {
jid.User = strings.TrimPrefix(jid.User, "+")
return jid
}
func CreateHTTPProxy(httpHost, httpPort, user, password string) (func(*http.Request) (*url.URL, error), error) {
address := fmt.Sprintf("http://%s:%s@%s:%s", user, password, httpHost, httpPort)