From 2ca323da8487a2f99d283bd78c8141a35b700cb3 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sat, 21 Sep 2024 23:18:50 +0100 Subject: [PATCH] my.fbmessenger.android: exclude unsent messages to avoid duplication --- my/fbmessenger/android.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/my/fbmessenger/android.py b/my/fbmessenger/android.py index 7e48c781..effababf 100644 --- a/my/fbmessenger/android.py +++ b/my/fbmessenger/android.py @@ -168,6 +168,15 @@ def _process_db_msys(db: sqlite3.Connection) -> Iterator[Res[Entity]]: CAST(sender_id AS TEXT) AS sender_id, reply_source_id FROM messages + WHERE + /* Regular message_id conforms to mid.* regex. + However seems that when message is not sent yet it doesn't have this server id yet + (happened only once, but could be just luck of course!) + We exclude these messages to avoid duplication. + However poisitive filter (e.g. message_id LIKE 'mid%') feels a bit wrong, e.g. what if mesage ids change or something + So instead this excludes only such unsent messages. + */ + message_id != offline_threading_id ORDER BY timestamp_ms /* they aren't in order in the database, so need to sort */ ''' ):