Skip to content

Commit

Permalink
fbmessenger.android: expose contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed Dec 28, 2023
1 parent a0ce666 commit 3ec362f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion my/fbmessenger/android.py
Expand Up @@ -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]] = {}
Expand Down Expand Up @@ -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] = {}
Expand Down

0 comments on commit 3ec362f

Please sign in to comment.