diff --git a/my/fbmessenger/android.py b/my/fbmessenger/android.py index fa313ea..ecf0eb0 100644 --- a/my/fbmessenger/android.py +++ b/my/fbmessenger/android.py @@ -111,12 +111,18 @@ def _process_db_msys(db: sqlite3.Connection) -> Iterator[Res[Entity]]: senders: Dict[str, Sender] = {} for r in db.execute('SELECT CAST(id AS TEXT) AS id, name FROM contacts'): s = Sender( - id=r['id'], + id=r['id'], # looks like it's server id? same used on facebook site name=r['name'], ) + # NOTE https://www.messenger.com/t/{contant_id} for permalink senders[s.id] = s yield s + # TODO what is fb transport?? + # TODO what are client_contacts?? has pk or something + + # TODO client_threads/client_messages -- possibly for end to end encryption or something? + # TODO can we get it from db? could infer as the most common id perhaps? self_id = config.facebook_id thread_users: Dict[str, List[Sender]] = {} @@ -237,6 +243,15 @@ def _process_db_threads_db2(db: sqlite3.Connection) -> Iterator[Res[Entity]]: ) +def contacts() -> Iterator[Res[Sender]]: + for x in unique_everseen(_entities): + if isinstance(x, Exception): + yield x + continue + if isinstance(x, Sender): + yield x + + def messages() -> Iterator[Res[Message]]: senders: Dict[str, Sender] = {} msgs: Dict[str, Message] = {}