Implement Manticore fully and re-theme
This commit is contained in:
@@ -1579,6 +1579,33 @@ class WhatsAppClient(ClientBase):
|
||||
out.add(f"{mapped}@s.whatsapp.net")
|
||||
return out
|
||||
|
||||
def _message_identifier_candidates(self, *, sender, chat, is_from_me):
|
||||
"""
|
||||
Resolve the logical contact for a WhatsApp message event.
|
||||
|
||||
Direct outbound messages must bind to the chat peer, not the sender,
|
||||
otherwise the user's own account identifier can fan out the same message
|
||||
into unrelated XMPP contact threads.
|
||||
"""
|
||||
sender_value = self._jid_to_identifier(sender)
|
||||
chat_value = self._jid_to_identifier(chat)
|
||||
candidate_values = []
|
||||
|
||||
if chat_value.endswith("@g.us"):
|
||||
candidate_values.append(chat)
|
||||
elif is_from_me:
|
||||
if chat_value:
|
||||
candidate_values.append(chat)
|
||||
elif sender_value:
|
||||
candidate_values.append(sender)
|
||||
else:
|
||||
if sender_value:
|
||||
candidate_values.append(sender)
|
||||
elif chat_value:
|
||||
candidate_values.append(chat)
|
||||
|
||||
return self._normalize_identifier_candidates(*candidate_values)
|
||||
|
||||
async def _sync_contacts_from_client(self):
|
||||
if self._client is None:
|
||||
return
|
||||
@@ -2666,7 +2693,11 @@ class WhatsAppClient(ClientBase):
|
||||
sender_jid=str(sender or ""),
|
||||
)
|
||||
|
||||
identifier_values = self._normalize_identifier_candidates(sender, chat)
|
||||
identifier_values = self._message_identifier_candidates(
|
||||
sender=sender,
|
||||
chat=chat,
|
||||
is_from_me=is_from_me,
|
||||
)
|
||||
if not identifier_values:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user