Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
bf84868d
by Philipp Hörist at 2022-09-11T09:00:35+02:00
4 changed files:
- gajim/common/modules/mam.py
- gajim/common/modules/message.py
- gajim/common/modules/util.py
- gajim/common/storage/archive.py
Changes:
| ... | ... | @@ -315,6 +315,7 @@ def _mam_message_received(self, |
| 315 | 315 | properties.jid,
|
| 316 | 316 | properties.body,
|
| 317 | 317 | kind,
|
| 318 | + properties.mam.timestamp,
|
|
| 318 | 319 | self._log):
|
| 319 | 320 | return
|
| 320 | 321 |
| ... | ... | @@ -201,6 +201,7 @@ def _message_received(self, |
| 201 | 201 | from_,
|
| 202 | 202 | msgtxt,
|
| 203 | 203 | kind,
|
| 204 | + properties.timestamp,
|
|
| 204 | 205 | self._log):
|
| 205 | 206 | return
|
| 206 | 207 | |
| ... | ... | @@ -396,7 +397,8 @@ def log_message(self, message: OutgoingMessage) -> None: |
| 396 | 397 | None,
|
| 397 | 398 | message.message,
|
| 398 | 399 | message.correct_id,
|
| 399 | - KindConstant.CHAT_MSG_SENT)
|
|
| 400 | + KindConstant.CHAT_MSG_SENT,
|
|
| 401 | + message.timestamp)
|
|
| 400 | 402 | return
|
| 401 | 403 | |
| 402 | 404 | app.storage.archive.insert_into_logs(
|
| ... | ... | @@ -128,6 +128,7 @@ def check_if_message_correction(properties: MessageProperties, |
| 128 | 128 | jid: JID,
|
| 129 | 129 | msgtxt: str,
|
| 130 | 130 | kind: KindConstant,
|
| 131 | + timestamp: float,
|
|
| 131 | 132 | logger: LoggerAdapter[logging.Logger]) -> bool:
|
| 132 | 133 | |
| 133 | 134 | correct_id = parse_correction(properties)
|
| ... | ... | @@ -158,7 +159,8 @@ def check_if_message_correction(properties: MessageProperties, |
| 158 | 159 | nickname,
|
| 159 | 160 | msgtxt,
|
| 160 | 161 | correct_id,
|
| 161 | - kind)
|
|
| 162 | + kind,
|
|
| 163 | + timestamp)
|
|
| 162 | 164 | |
| 163 | 165 | if not successful:
|
| 164 | 166 | logger.info('Message correction not successful')
|
| ... | ... | @@ -990,7 +990,8 @@ def try_message_correction(self, |
| 990 | 990 | nickname: Optional[str],
|
| 991 | 991 | corrected_text: str,
|
| 992 | 992 | correct_id: str,
|
| 993 | - kind: KindConstant) -> bool:
|
|
| 993 | + kind: KindConstant,
|
|
| 994 | + timestamp: float) -> bool:
|
|
| 994 | 995 | |
| 995 | 996 | '''Try to correct a message
|
| 996 | 997 | |
| ... | ... | @@ -1001,7 +1002,7 @@ def try_message_correction(self, |
| 1001 | 1002 | '''
|
| 1002 | 1003 | |
| 1003 | 1004 | account_id = self.get_account_id(account)
|
| 1004 | - max_timestamp = time.time() - MAX_MESSAGE_CORRECTION_DELAY
|
|
| 1005 | + max_timestamp = timestamp - MAX_MESSAGE_CORRECTION_DELAY
|
|
| 1005 | 1006 | |
| 1006 | 1007 | self._log.debug(
|
| 1007 | 1008 | 'Check if message is correctable, parameters: %s %s %s %s %s',
|