Philipp Hörist pushed to branch master at gajim / gajim
Commits: bf84868d by Philipp Hörist at 2022-09-11T09:00:35+02:00 cfix: Use correct timestamp for evaluating message corrections
- - - - -
4 changed files:
- gajim/common/modules/mam.py - gajim/common/modules/message.py - gajim/common/modules/util.py - gajim/common/storage/archive.py
Changes:
===================================== gajim/common/modules/mam.py ===================================== @@ -315,6 +315,7 @@ def _mam_message_received(self, properties.jid, properties.body, kind, + properties.mam.timestamp, self._log): return
===================================== gajim/common/modules/message.py ===================================== @@ -201,6 +201,7 @@ def _message_received(self, from_, msgtxt, kind, + properties.timestamp, self._log): return
@@ -396,7 +397,8 @@ def log_message(self, message: OutgoingMessage) -> None: None, message.message, message.correct_id, - KindConstant.CHAT_MSG_SENT) + KindConstant.CHAT_MSG_SENT, + message.timestamp) return
app.storage.archive.insert_into_logs(
===================================== 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')
===================================== gajim/common/storage/archive.py ===================================== @@ -990,7 +990,8 @@ def try_message_correction(self, 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 @@ def try_message_correction(self, '''
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',
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/bf84868d659a0d71783212f9b7fa629b4...