From 88da6869b4662520fe2181a69cbc9d96e50ea1de Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 12 Oct 2012 15:29:45 +0000 Subject: When a message is corrected, display it correctly in place of the previous one. --- src/tabs.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 2895b784..beb98cc9 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1564,7 +1564,11 @@ class MucTab(ChatTab): return user return None - def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None, history=None): + def modify_message(self, txt, old_id, new_id): + self._text_buffer.modify_message(txt, old_id, new_id) + self.core.refresh_window() + + def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None, history=None, identifier=None): """ Note that user can be None even if nickname is not None. It happens when we receive an history message said by someone who is not @@ -1591,7 +1595,7 @@ class MucTab(ChatTab): if highlight: nick_color = highlight time = time or datetime.now() - self._text_buffer.add_message(txt, time, nickname, nick_color, history, user, highlight=highlight) + self._text_buffer.add_message(txt, time, nickname, nick_color, history, user, highlight=highlight, identifier=identifier) return highlight class PrivateTab(ChatTab): @@ -1869,12 +1873,17 @@ class PrivateTab(ChatTab): if reason: self.add_message(txt=reason) - def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None): + def modify_message(self, txt, old_id, new_id): + self._text_buffer.modify_message(txt, old_id, new_id) + self.core.refresh_window() + + def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None, identifier=None): self._text_buffer.add_message(txt, time=time, nickname=nickname, nick_color=nick_color, history=None, - user=forced_user) + user=forced_user, + identifier=identifier) class RosterInfoTab(Tab): """ @@ -2958,12 +2967,17 @@ class ConversationTab(ChatTab): if config.get_by_tabname('send_chat_states', 'true', self.general_jid, True) == 'true': self.send_chat_state('gone') - def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None): + def modify_message(self, txt, old_id, new_id): + self._text_buffer.modify_message(txt, old_id, new_id) + self.core.refresh_window() + + def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None, identifier=None): self._text_buffer.add_message(txt, time=time, nickname=nickname, nick_color=nick_color, history=None, - user=forced_user) + user=forced_user, + identifier=identifier) class MucListTab(Tab): -- cgit v1.2.3