diff options
author | Philipp Hörist <philipp@hoerist.com> | 2022-09-11 10:00:35 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2022-09-11 10:00:35 +0300 |
commit | bf84868d659a0d71783212f9b7fa629b4c66a43e (patch) | |
tree | b36b58f50f2352bcb898ea9640f91ac6da4b3dba | |
parent | 9a591533c6b7f7405c0433d7c5668a8c6e76765c (diff) |
cfix: Use correct timestamp for evaluating message corrections
-rw-r--r-- | gajim/common/modules/mam.py | 1 | ||||
-rw-r--r-- | gajim/common/modules/message.py | 4 | ||||
-rw-r--r-- | gajim/common/modules/util.py | 4 | ||||
-rw-r--r-- | gajim/common/storage/archive.py | 5 |
4 files changed, 10 insertions, 4 deletions
diff --git a/gajim/common/modules/mam.py b/gajim/common/modules/mam.py index f7c24c84f..e1e2c7a14 100644 --- a/gajim/common/modules/mam.py +++ b/gajim/common/modules/mam.py @@ -315,6 +315,7 @@ class MAM(BaseModule): properties.jid, properties.body, kind, + properties.mam.timestamp, self._log): return diff --git a/gajim/common/modules/message.py b/gajim/common/modules/message.py index b58fd23b4..2641a8bf5 100644 --- a/gajim/common/modules/message.py +++ b/gajim/common/modules/message.py @@ -201,6 +201,7 @@ class Message(BaseModule): from_, msgtxt, kind, + properties.timestamp, self._log): return @@ -396,7 +397,8 @@ class Message(BaseModule): None, message.message, message.correct_id, - KindConstant.CHAT_MSG_SENT) + KindConstant.CHAT_MSG_SENT, + message.timestamp) return app.storage.archive.insert_into_logs( diff --git a/gajim/common/modules/util.py b/gajim/common/modules/util.py index fcddc94b2..3d5389083 100644 --- a/gajim/common/modules/util.py +++ b/gajim/common/modules/util.py @@ -128,6 +128,7 @@ def check_if_message_correction(properties: MessageProperties, jid: JID, msgtxt: str, kind: KindConstant, + timestamp: float, logger: LoggerAdapter[logging.Logger]) -> bool: correct_id = parse_correction(properties) @@ -158,7 +159,8 @@ def check_if_message_correction(properties: MessageProperties, nickname, msgtxt, correct_id, - kind) + kind, + timestamp) if not successful: logger.info('Message correction not successful') diff --git a/gajim/common/storage/archive.py b/gajim/common/storage/archive.py index bf29abd48..bb2926482 100644 --- a/gajim/common/storage/archive.py +++ b/gajim/common/storage/archive.py @@ -990,7 +990,8 @@ class MessageArchiveStorage(SqliteStorage): nickname: Optional[str], corrected_text: str, correct_id: str, - kind: KindConstant) -> bool: + kind: KindConstant, + timestamp: float) -> bool: '''Try to correct a message @@ -1001,7 +1002,7 @@ class MessageArchiveStorage(SqliteStorage): ''' account_id = self.get_account_id(account) - max_timestamp = time.time() - MAX_MESSAGE_CORRECTION_DELAY + max_timestamp = timestamp - MAX_MESSAGE_CORRECTION_DELAY self._log.debug( 'Check if message is correctable, parameters: %s %s %s %s %s', |