diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-11-07 23:47:49 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-11-07 23:49:24 +0100 |
commit | 32a75fd5c746ba6080f43ef56be361deb2e3bad3 (patch) | |
tree | 19ab6fb8a4922eed728ea7d32c922cd2086c9140 /src | |
parent | 934006e2e90f70009a6ff354ee4f4541cc5b47fc (diff) | |
download | poezio-32a75fd5c746ba6080f43ef56be361deb2e3bad3.tar.gz poezio-32a75fd5c746ba6080f43ef56be361deb2e3bad3.tar.bz2 poezio-32a75fd5c746ba6080f43ef56be361deb2e3bad3.tar.xz poezio-32a75fd5c746ba6080f43ef56be361deb2e3bad3.zip |
Trigger conversation_say and private_say only once,
and fix the place where we add the message to the window (before
removing the colors)
Diffstat (limited to 'src')
-rw-r--r-- | src/tabs.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/tabs.py b/src/tabs.py index 02d3c90d..984d428f 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1215,15 +1215,14 @@ class PrivateTab(ChatTab): # This lets a plugin insert \x19xxx} colors, that will # be converted in xhtml. self.core.events.trigger('private_say', msg) + self.core.add_message_to_text_buffer(self._text_buffer, msg['body'], None, self.core.own_nick or self.own_nick) if msg['body'].find('\x19') != -1: - msg['body'] = xhtml.clean_text(msg['body']) msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body']) + msg['body'] = xhtml.clean_text(msg['body']) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed - self.core.events.trigger('private_say', msg) msg.send() - self.core.add_message_to_text_buffer(self._text_buffer, xhtml.convert_simple_to_full_colors(line), None, self.core.own_nick or self.own_nick) self.cancel_paused_delay() self.text_win.refresh() self.input.refresh() @@ -1879,18 +1878,18 @@ class ConversationTab(ChatTab): msg['type'] = 'chat' msg['body'] = line # trigger the event BEFORE looking for colors. + # and before displaying the message in the window # This lets a plugin insert \x19xxx} colors, that will # be converted in xhtml. self.core.events.trigger('conversation_say', msg) + self.core.add_message_to_text_buffer(self._text_buffer, msg['body'], None, self.core.own_nick) if msg['body'].find('\x19') != -1: - msg['body'] = xhtml.clean_text(msg['body']) msg['xhtml_im'] = xhtml.poezio_colors_to_html(msg['body']) + msg['body'] = xhtml.clean_text(msg['body']) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' msg['chat_state'] = needed - self.core.events.trigger('conversation_say', msg) msg.send() - self.core.add_message_to_text_buffer(self._text_buffer, xhtml.convert_simple_to_full_colors(line), None, self.core.own_nick) logger.log_message(JID(self.get_name()).bare, self.core.own_nick, line) self.cancel_paused_delay() self.text_win.refresh() |