summaryrefslogtreecommitdiff
path: root/src/tabs.py
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2011-11-08 00:19:31 +0100
committerFlorent Le Coz <louiz@louiz.org>2011-11-08 00:19:31 +0100
commit4610a1d6e3de68cedb2cd61d270b92ec714c44c7 (patch)
tree48fc476fa63cfb38ecc24adea02abfdaf57bb546 /src/tabs.py
parentf13d03c149a94a8316b9acb5944454357a395636 (diff)
downloadpoezio-4610a1d6e3de68cedb2cd61d270b92ec714c44c7.tar.gz
poezio-4610a1d6e3de68cedb2cd61d270b92ec714c44c7.tar.bz2
poezio-4610a1d6e3de68cedb2cd61d270b92ec714c44c7.tar.xz
poezio-4610a1d6e3de68cedb2cd61d270b92ec714c44c7.zip
trigger events *_say BEFORE generating the xhtml, making it possible to add colors in the hook
Conflicts: src/tabs.py
Diffstat (limited to 'src/tabs.py')
-rw-r--r--src/tabs.py27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/tabs.py b/src/tabs.py
index f80abdf7..506d1de9 100644
--- a/src/tabs.py
+++ b/src/tabs.py
@@ -710,11 +710,10 @@ class MucTab(ChatTab):
needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active'
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'groupchat'
- if line.find('\x19') == -1:
- msg['body'] = line
- else:
- msg['body'] = xhtml.clean_text_simple(line)
- msg['xhtml_im'] = xhtml.poezio_colors_to_html(line)
+ msg['body'] = line
+ if msg['body'].find('\x19') != -1:
+ 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:
msg['chat_state'] = needed
self.cancel_paused_delay()
@@ -1202,11 +1201,10 @@ class PrivateTab(ChatTab):
return
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'chat'
- if line.find('\x19') == -1:
- msg['body'] = line
- else:
- msg['body'] = xhtml.clean_text_simple(line)
- msg['xhtml_im'] = xhtml.poezio_colors_to_html(line)
+ msg['body'] = line
+ if msg['body'].find('\x19') != -1:
+ msg['body'] = xhtml.clean_text(msg['body'])
+ msg['xhtml_im'] = xhtml.poezio_colors_to_html(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
@@ -1865,11 +1863,10 @@ class ConversationTab(ChatTab):
def command_say(self, line):
msg = self.core.xmpp.make_message(self.get_name())
msg['type'] = 'chat'
- if line.find('\x19') == -1:
- msg['body'] = line
- else:
- msg['body'] = xhtml.clean_text_simple(line)
- msg['xhtml_im'] = xhtml.poezio_colors_to_html(line)
+ msg['body'] = line
+ if msg['body'].find('\x19') != -1:
+ msg['body'] = xhtml.clean_text(msg['body'])
+ msg['xhtml_im'] = xhtml.poezio_colors_to_html(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