From 4e0c1b0820432460750ea69c5bdeb47670f4c013 Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 9 Nov 2011 23:17:00 +0100 Subject: New events in the plugins API --- src/core.py | 5 +++++ src/events.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/core.py b/src/core.py index e6b1239b..986d1222 100644 --- a/src/core.py +++ b/src/core.py @@ -325,6 +325,7 @@ class Core(object): tab = self.get_tab_of_conversation_with_jid(message['from'], False) if not tab: return False + self.events.trigger('normal_chatstate', message, tab) tab.chatstate = state if tab == self.current_tab(): tab.refresh_info_header() @@ -335,6 +336,7 @@ class Core(object): tab = self.get_tab_by_name(message['from'].full, tabs.PrivateTab) if not tab: return + self.events.trigger('private_chatstate', message, tab) tab.chatstate = state if tab == self.current_tab(): tab.refresh_info_header() @@ -346,6 +348,7 @@ class Core(object): room_from = message.getMucroom() tab = self.get_tab_by_name(room_from, tabs.MucTab) if tab and tab.get_user_by_name(nick): + self.events.trigger('muc_chatstate', message, tab) tab.get_user_by_name(nick).chatstate = state if tab == self.current_tab(): tab.user_win.refresh(tab.users) @@ -487,6 +490,7 @@ class Core(object): from_room = presence['from'].bare tab = self.get_tab_by_name(from_room, tabs.MucTab) if tab: + self.events.trigger('muc_presence', presence, tab) tab.handle_presence(presence) def rename_private_tabs(self, room_name, old_nick, new_nick): @@ -652,6 +656,7 @@ class Core(object): resource = contact.get_resource_by_fulljid(jid.full) if not resource: return + self.events.trigger('normal_presence', presence, resource) status = presence['type'] status_message = presence['status'] priority = presence.getPriority() or 0 diff --git a/src/events.py b/src/events.py index cd45448f..1464b2d8 100644 --- a/src/events.py +++ b/src/events.py @@ -27,6 +27,11 @@ class EventHandler(object): 'conversation_msg': [], 'private_msg': [], 'muc_msg': [], + 'normal_chatstate': [], + 'muc_chatsate': [], + 'private_chatsate': [], + 'normal_presence': [], + 'muc_presence': [], } def add_event_handler(self, name, callback, position=0): -- cgit v1.2.3