diff options
Diffstat (limited to 'gajim/gtk/message_input.py')
-rw-r--r-- | gajim/gtk/message_input.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/gajim/gtk/message_input.py b/gajim/gtk/message_input.py index 4b682498b..e6dea3117 100644 --- a/gajim/gtk/message_input.py +++ b/gajim/gtk/message_input.py @@ -140,9 +140,12 @@ class MessageInputTextView(Gtk.TextView, EventHelper): if message_row is None or message_row.message is None: return + text = message_row.message + if message_row.correction is not None: + text = message_row.correction.message self._set_correcting(True) self.get_style_context().add_class('gajim-msg-correcting') - self.insert_text(message_row.message) + self.insert_text(text) def try_message_correction(self, message: str) -> str | None: assert self._contact is not None @@ -169,18 +172,21 @@ class MessageInputTextView(Gtk.TextView, EventHelper): self._correcting[self._contact] = state def _on_message_sent(self, event: MessageSent) -> None: - if not event.message: + joined_data = event.joined_data + if not joined_data.message: return - if event.correct_id is None: - # This wasn't a corrected message - assert self._contact is not None - oob_url = event.additional_data.get_value('gajim', 'oob_url') - if oob_url == event.message: - # Don't allow to correct HTTP Upload file transfer URLs - self._last_message_id[self._contact] = None - else: - self._last_message_id[self._contact] = event.message_id + if joined_data.correction is not None: + return + + assert self._contact is not None + + if (joined_data.oob is not None and + joined_data.oob.url == joined_data.message): + # Don't allow to correct HTTP Upload file transfer URLs + self._last_message_id[self._contact] = None + else: + self._last_message_id[self._contact] = joined_data.message_id def _init_spell_checker(self) -> int: if not app.is_installed('GSPELL'): |