Skip to content

Commit 1f65164

Browse files
committed
userinfo: add debug log if lid and pn contact info don't agree
1 parent 3531a96 commit 1f65164

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pkg/connector/userinfo.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,28 @@ func (wa *WhatsAppClient) contactToUserInfo(ctx context.Context, jid types.JID,
225225
if contact.BusinessName == "" {
226226
contact.BusinessName = extraContact.BusinessName
227227
}
228+
if contact.PushName != "" && extraContact.PushName != "" && contact.PushName != extraContact.PushName {
229+
zerolog.Ctx(ctx).Debug().
230+
Stringer("source_jid", jid).
231+
Stringer("alt_jid", altJID).
232+
Str("source_push_name", contact.PushName).
233+
Str("alt_push_name", extraContact.PushName).
234+
Msg("Conflicting push names between JIDs")
235+
if altJID.Server == types.DefaultUserServer {
236+
contact.PushName = extraContact.PushName
237+
}
238+
}
239+
if contact.BusinessName != "" && extraContact.BusinessName != "" && contact.BusinessName != extraContact.BusinessName {
240+
zerolog.Ctx(ctx).Debug().
241+
Stringer("source_jid", jid).
242+
Stringer("alt_jid", altJID).
243+
Str("source_push_name", contact.BusinessName).
244+
Str("alt_push_name", extraContact.BusinessName).
245+
Msg("Conflicting business names between JIDs")
246+
if altJID.Server == types.DefaultUserServer {
247+
contact.BusinessName = extraContact.BusinessName
248+
}
249+
}
228250
}
229251
}
230252
}

0 commit comments

Comments
 (0)