summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-09 14:23:38 +0100
committermathieui <mathieui@mathieui.net>2011-11-09 14:23:38 +0100
commit5e840e64373522c484dfd4e24d4a60bcb7c21825 (patch)
treec14e64806e13355339b2dbec3e784ac07e5cae26
parentcc7f010aed20c726b69f99b58f9c7578e5ff1dc1 (diff)
downloadpoezio-5e840e64373522c484dfd4e24d4a60bcb7c21825.tar.gz
poezio-5e840e64373522c484dfd4e24d4a60bcb7c21825.tar.bz2
poezio-5e840e64373522c484dfd4e24d4a60bcb7c21825.tar.xz
poezio-5e840e64373522c484dfd4e24d4a60bcb7c21825.zip
Give the concerned tab to the _msg handlers
-rw-r--r--src/core.py12
1 files 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