diff --git a/.rgignore b/.rgignore index 5d79fc5..4dba4e4 100644 --- a/.rgignore +++ b/.rgignore @@ -1 +1,2 @@ ariadne +example diff --git a/rime/providers/androidwhatsapp.py b/rime/providers/androidwhatsapp.py index d6a24d6..72c0b19 100644 --- a/rime/providers/androidwhatsapp.py +++ b/rime/providers/androidwhatsapp.py @@ -365,7 +365,9 @@ def search_events(self, device, filter_): # is as indicated by sender_jid_row_id. # Find the sender. - if row[fields['sender_jid_row_id']] == 0: + if row[fields['from_me']]: + sender = device.device_operator_contact + elif row[fields['sender_jid_row_id']] == 0: # Group chat. author_device_jid = row[fields['author_device_jid']] if author_device_jid: @@ -376,10 +378,7 @@ def search_events(self, device, filter_): # Private chat. sender = self._get_contact(row[fields['sender_jid_row_id']]) # may be None - # One reason for sender to be none is that it's the device operator. - if sender is None and bool(row[fields['from_me']]): - sender = device.device_operator_contact - else: + if sender is None: sender = device.unknown_contact # Store session info. @@ -472,7 +471,7 @@ def subset(self, subsetter, events: Iterable[Event], contacts: Iterable[Contact] wa_message = event.provider_data rows_message.add(wa_message.message_row_id) - if event.sender: + if event.sender and event.sender.provider_data: rows_jid.update(jid_contact.id_ for jid_contact in event.sender.provider_data.jid_contacts) if event.session: