Philipp Hörist pushed to branch storage at gajim / gajim
Commits:
6b7fc91f by Philipp Hörist at 2023-07-08T07:30:38+02:00
Remove obsolete code
- - - - -
2 changed files:
- gajim/common/storage/archiveold.py
- gajim/gtk/chat_stack.py
Changes:
=====================================
gajim/common/storage/archiveold.py
=====================================
@@ -109,79 +109,3 @@ def get_conversation_around(self,
sql_at_after,
tuple(jids) + (timestamp, n_lines)).fetchall()
return before, at_after
-
- @timeit
- def try_message_correction(self,
- account: str,
- jid: JID,
- nickname: str | None,
- corrected_text: str,
- correct_id: str,
- kind: KindConstant,
- timestamp: float) -> bool:
-
- '''Try to correct a message
-
- :param jid: This can be a full jid or bare jid. A full jid only if the
- message is a MUC PM, otherwise a bare jid needs to be
- passed. `nickname` should only be passed if the message
- is a group chat message.
- '''
-
- account_id = self.get_account_id(account)
- max_timestamp = timestamp - MAX_MESSAGE_CORRECTION_DELAY
-
- self._log.debug(
- 'Check if message is correctable, parameters: %s %s %s %s %s',
- jid, account_id, nickname, correct_id, max_timestamp)
-
- sql = '''SELECT log_line_id, message, additional_data
- FROM logs
- NATURAL JOIN jids jid_id
- WHERE +jid = ?
- AND account_id = ?
- AND contact_name IS ?
- AND message_id = ?
- AND kind = ?
- AND time > ?
- '''
-
- rows = self._con.execute(sql, (jid,
- account_id,
- nickname,
- correct_id,
- kind,
- max_timestamp
- )).fetchall()
-
- if not rows:
- self._log.debug('No correctable messages found')
- return False
-
- if len(rows) != 1:
- self._log.warning('More than one correctable message found')
- return False
-
- row = rows[0]
-
- if row.additional_data is None:
- additional_data = AdditionalDataDict()
- else:
- additional_data = row.additional_data
-
- original_text = additional_data.get_value(
- 'corrected', 'original_text')
- if original_text is None:
- # Only set original_text for the first correction
- additional_data.set_value(
- 'corrected', 'original_text', row.message)
- serialized_dict = json.dumps(additional_data.data)
-
- sql = '''
- UPDATE logs SET message = ?, additional_data = ?
- WHERE log_line_id = ?
- '''
- self._con.execute(
- sql, (corrected_text, serialized_dict, row.log_line_id))
-
- return True
=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -772,13 +772,6 @@ def _on_send_message(self) -> None:
label = self._message_action_box.get_seclabel()
- correct_id = None
- if self._message_action_box.is_correcting:
- correct_id = self._message_action_box.try_message_correction(
- message)
- if correct_id is None:
- return
-
chatstate = client.get_module('Chatstate').get_active_chatstate(
contact)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/6b7fc91f12cf118e0bb1afcfc5363640ed419777
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/6b7fc91f12cf118e0bb1afcfc5363640ed419777
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]