user: fix parsing not on whatsapp responses

This commit is contained in:
Tulir Asokan
2026-07-13 14:28:32 +03:00
parent 592721a00b
commit d8960d9575
+7 -3
View File
@@ -195,13 +195,17 @@ func (cli *Client) IsOnWhatsApp(ctx context.Context, phones []string) ([]types.I
querySuffix := "@" + types.LegacyUserServer
for _, child := range list.GetChildren() {
ag := child.AttrGetter()
jid, jidOK := ag.GetJID("jid", true)
if child.Tag != "user" || !jidOK {
jid := ag.OptionalJIDOrEmpty("jid")
pnJID := ag.OptionalJIDOrEmpty("pn_jid")
if child.Tag != "user" || (jid.IsEmpty() && pnJID.IsEmpty()) {
continue
}
var info types.IsOnWhatsAppResponse
info.JID = jid
info.PhoneNumber = ag.OptionalJIDOrEmpty("pn_jid")
if jid.IsEmpty() {
info.JID = pnJID
}
info.PhoneNumber = pnJID
if info.JID.Server == types.HiddenUserServer && info.PhoneNumber.Server == types.DefaultUserServer {
lidEntries = append(lidEntries, store.LIDMapping{
LID: info.JID,