fbmessenger.android: fix minor issue with processing thread participants

This commit is contained in:
Dima Gerasimov 2024-08-03 18:45:22 +01:00 committed by karlicoss
parent 9e72672b4f
commit 652ee9b875

View file

@ -1,6 +1,7 @@
""" """
Messenger data from Android app database (in =/data/data/com.facebook.orca/databases/threads_db2=) Messenger data from Android app database (in =/data/data/com.facebook.orca/databases/threads_db2=)
""" """
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass from dataclasses import dataclass
@ -129,14 +130,17 @@ def _process_db_msys(db: sqlite3.Connection) -> Iterator[Res[Entity]]:
for r in db.execute('SELECT CAST(thread_key AS TEXT) AS thread_key, CAST(contact_id AS TEXT) AS contact_id FROM participants'): for r in db.execute('SELECT CAST(thread_key AS TEXT) AS thread_key, CAST(contact_id AS TEXT) AS contact_id FROM participants'):
thread_key = r['thread_key'] thread_key = r['thread_key']
user_key = r['contact_id'] user_key = r['contact_id']
if self_id is not None and user_key == self_id:
# exclude yourself, otherwise it's just spammy to show up in all participants
continue
ll = thread_users.get(thread_key) ll = thread_users.get(thread_key)
if ll is None: if ll is None:
ll = [] ll = []
thread_users[thread_key] = ll thread_users[thread_key] = ll
if self_id is not None and user_key == self_id:
# exclude yourself, otherwise it's just spammy to show up in all participants
# TODO not sure about that, maybe change later
continue
ll.append(senders[user_key]) ll.append(senders[user_key])
# 15 is a weird thread that doesn't have any participants and messages # 15 is a weird thread that doesn't have any participants and messages