From 5e840e64373522c484dfd4e24d4a60bcb7c21825 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 14:23:38 +0100 Subject: Give the concerned tab to the _msg handlers --- src/core.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core.py b/src/core.py index f1f48a2b..a7c331ef 100644 --- a/src/core.py +++ b/src/core.py @@ -567,7 +567,7 @@ class Core(object): tab = self.open_private_window(room_from, nick_from, False) if not tab: return - self.events.trigger('private_msg', message) + self.events.trigger('private_msg', message, tab) if not body: return tab.add_message(body, time=None, nickname=nick_from, @@ -616,13 +616,17 @@ class Core(object): When receiving "normal" messages (from someone in our roster) """ jid = message['from'] - self.events.trigger('conversation_msg', message) body = xhtml.get_body_from_message_stanza(message) + conversation = self.get_tab_of_conversation_with_jid(jid, create=False) if not body: if message['type'] == 'error': self.information(self.get_error_message_from_error_stanza(message), 'Error') - return + return + elif not conversation: + return conversation = self.get_tab_of_conversation_with_jid(jid, create=True) + self.events.trigger('conversation_msg', message, conversation) + body = xhtml.get_body_from_message_stanza(message) if roster.get_contact_by_jid(jid.bare): remote_nick = roster.get_contact_by_jid(jid.bare).get_name() or jid.user else: @@ -1057,7 +1061,7 @@ class Core(object): if tab.get_user_by_name(nick_from) and\ tab.get_user_by_name(nick_from) in tab.ignores: return - self.events.trigger('muc_msg', message) + self.events.trigger('muc_msg', message, tab) body = xhtml.get_body_from_message_stanza(message) if body: date = date if delayed == True else None -- cgit v1.2.3