From 92e63829a699ec68e7dcc2185fb7393255342dd2 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Wed, 30 Mar 2011 04:34:45 +0200 Subject: Finish colors support with xhtml (clean the elinks dump, handle the input etc) --- src/tabs.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index b7624c2b..53115716 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -39,6 +39,7 @@ import string import common import core import singleton +import xhtml import multiuserchat as muc @@ -270,7 +271,8 @@ class ChatTab(Tab): def on_enter(self): txt = self.input.key_enter() - if not self.execute_command(txt): + clean_text = xhtml.clean_text(txt) + if not self.execute_command(clean_text): if txt.startswith('//'): txt = txt[1:] self.command_say(txt) @@ -556,7 +558,11 @@ class MucTab(ChatTab): def command_say(self, line): msg = self.core.xmpp.make_message(self.get_name()) msg['type'] = 'groupchat' - msg['body'] = line + if line.find('\x19') == -1: + msg['body'] = line + else: + msg['body'] = xhtml.clean_text(line) + msg['xhtml_im'] = xhtml.poezio_colors_to_html(line) if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: msg['chat_state'] = 'active' msg.send() -- cgit v1.2.3