From d01f6208d67f6c88584fc1f362dae0a9f2d107d0 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 16 Jul 2013 22:39:36 +0200 Subject: =?UTF-8?q?If=20plugins=20removed=20the=20message=20body=20in=20a?= =?UTF-8?q?=20callback,=20don=E2=80=99t=20send=20it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/tabs.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index 80182a52..e5564aa6 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1240,6 +1240,8 @@ class MucTab(ChatTab): # This lets a plugin insert \x19xxx} colors, that will # be converted in xhtml. self.core.events.trigger('muc_say', msg, self) + if not msg['body']: + return if msg['body'].find('\x19') != -1: msg.enable('html') msg['html']['body'] = xhtml.poezio_colors_to_html(msg['body']) @@ -1250,6 +1252,8 @@ class MucTab(ChatTab): msg['replace']['id'] = self.last_sent_message['id'] self.cancel_paused_delay() self.core.events.trigger('muc_say_after', msg, self) + if not msg['body']: + return self.last_sent_message = msg msg.send() self.chat_state = needed @@ -1908,6 +1912,8 @@ class PrivateTab(ChatTab): # This lets a plugin insert \x19xxx} colors, that will # be converted in xhtml. self.core.events.trigger('private_say', msg, self) + if not msg['body']: + return user = self.parent_muc.get_user_by_name(self.own_nick) replaced = False if correct: @@ -1938,6 +1944,8 @@ class PrivateTab(ChatTab): if attention and self.remote_supports_attention: msg['attention'] = True self.core.events.trigger('private_say_after', msg, self) + if not msg['body']: + return self.last_sent_message = msg msg.send() self.cancel_paused_delay() @@ -3100,6 +3108,8 @@ class ConversationTab(ChatTab): # This lets a plugin insert \x19xxx} colors, that will # be converted in xhtml. self.core.events.trigger('conversation_say', msg, self) + if not msg['body']: + return replaced = False if correct: msg['replace']['id'] = self.last_sent_message['id'] @@ -3127,6 +3137,8 @@ class ConversationTab(ChatTab): if attention and self.remote_supports_attention: msg['attention'] = True self.core.events.trigger('conversation_say_after', msg, self) + if not msg['body']: + return self.last_sent_message = msg msg.send() self.cancel_paused_delay() -- cgit v1.2.3