diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-09 23:17:00 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-09 23:17:00 +0100 |
commit | 4e0c1b0820432460750ea69c5bdeb47670f4c013 (patch) | |
tree | 226e163ca062db0a4dd2dd79153b888485043890 /src | |
parent | f55a0c92f21e8b0c5cbd1e0413f2c2a95b29a8ae (diff) | |
download | poezio-4e0c1b0820432460750ea69c5bdeb47670f4c013.tar.gz poezio-4e0c1b0820432460750ea69c5bdeb47670f4c013.tar.bz2 poezio-4e0c1b0820432460750ea69c5bdeb47670f4c013.tar.xz poezio-4e0c1b0820432460750ea69c5bdeb47670f4c013.zip |
New events in the plugins API
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 5 | ||||
-rw-r--r-- | src/events.py | 5 |
2 files changed, 10 insertions, 0 deletions
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): |