feat(history): fortify contact data extraction with fallbacks

- Add fallback chain for contact name: displayName || name || username
- Add fallback for LID: lidJid || accountLid
- Add TODO marker for WAJIDHASH support in picture updates

These fallbacks improve robustness when WhatsApp returns contact
data in different fields depending on account type (business, personal).
This commit is contained in:
Claude
2026-01-22 19:48:20 +00:00
parent 5d97e170d2
commit 1dfdd47a12
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -765,6 +765,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
const setPicture = getBinaryNodeChild(node, 'set')
const delPicture = getBinaryNodeChild(node, 'delete')
// TODO: WAJIDHASH stuff proper support inhouse
ev.emit('contacts.update', [
{
id: jidNormalizedUser(node?.attrs?.from) || (setPicture || delPicture)?.attrs?.hash || '',
+2 -2
View File
@@ -326,8 +326,8 @@ export const processHistoryMessage = (item: proto.IHistorySync, logger?: ILogger
contacts.push({
id: chatId,
name: chat.name || undefined,
lid: chat.lidJid || undefined,
name: chat.displayName || chat.name || chat.username || undefined,
lid: chat.lidJid || chat.accountLid || undefined,
phoneNumber: chat.pnJid || undefined
})