Add somme triggers

This commit is contained in:
mathieui 2011-11-07 14:45:08 +01:00
parent 452f62ecf4
commit 1f3fafe155
2 changed files with 6 additions and 0 deletions

View file

@ -555,6 +555,7 @@ class Core(object):
tab = self.open_private_window(room_from, nick_from, False) tab = self.open_private_window(room_from, nick_from, False)
if not tab: if not tab:
return return
self.events.trigger('private_msg', message)
body = xhtml.get_body_from_message_stanza(message) body = xhtml.get_body_from_message_stanza(message)
if not body: if not body:
return return
@ -604,6 +605,7 @@ class Core(object):
When receiving "normal" messages (from someone in our roster) When receiving "normal" messages (from someone in our roster)
""" """
jid = message['from'] jid = message['from']
self.events.trigger('conversation_msg', message)
body = xhtml.get_body_from_message_stanza(message) body = xhtml.get_body_from_message_stanza(message)
if not body: if not body:
if message['type'] == 'error': if message['type'] == 'error':
@ -1044,6 +1046,7 @@ class Core(object):
if tab.get_user_by_name(nick_from) and\ if tab.get_user_by_name(nick_from) and\
tab.get_user_by_name(nick_from) in tab.ignores: tab.get_user_by_name(nick_from) in tab.ignores:
return return
self.events.trigger('muc_mg', message)
body = xhtml.get_body_from_message_stanza(message) body = xhtml.get_body_from_message_stanza(message)
if body: if body:
date = date if delayed == True else None date = date if delayed == True else None

View file

@ -25,6 +25,9 @@ class EventHandler(object):
'muc_say': [], 'muc_say': [],
'conversation_say': [], 'conversation_say': [],
'private_say': [], 'private_say': [],
'conversation_msg': [],
'private_msg': [],
'muc_msg': [],
} }
def add_event_handler(self, name, callback, first=True, last=False, position=None): def add_event_handler(self, name, callback, first=True, last=False, position=None):