diff options
author | Yann Leboulanger <asterix@lagaule.org> | 2011-05-02 00:09:50 +0400 |
---|---|---|
committer | Yann Leboulanger <asterix@lagaule.org> | 2011-05-02 00:09:50 +0400 |
commit | 857ba5f70799c832a73db6460a8dad4654e3ec45 (patch) | |
tree | 8572a064419a2dd7b19bf62e66f4ab17be8ba447 /plugins | |
parent | 92505408259e0bb21bd302fefb44101eb64d4727 (diff) |
new way to handle incominf messages, new notification event.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/snarl_notifications/plugin.py | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/plugins/snarl_notifications/plugin.py b/plugins/snarl_notifications/plugin.py index b152eac1d..7dfe24d26 100644 --- a/plugins/snarl_notifications/plugin.py +++ b/plugins/snarl_notifications/plugin.py @@ -45,7 +45,7 @@ class SnarlNotificationsPlugin(GajimPlugin): #self.gui_extension_points = {} #self.config_default_values = {} - self.events_handlers = {'NewMessage' : (ged.POSTCORE, self.newMessage)} + self.events_handlers = {'notification' : (ged.POSTCORE, self.notif)} @log_calls('SnarlNotificationsPlugin') def activate(self): @@ -56,29 +56,12 @@ class SnarlNotificationsPlugin(GajimPlugin): pass @log_calls('SnarlNotificationsPlugin') - def newMessage(self, args): - event_name = "NewMessage" - data = args - account = data[0] - jid = data[1][0] - jid_without_resource = gajim.get_jid_without_resource(jid) - msg = data[1][1] - msg_type = data[1][4] - if msg_type == 'chat': - nickname = gajim.get_contact_name_from_jid(account, jid_without_resource) - elif msg_type in ('pm', 'groupchat'): - nickname = gajim.get_resource_from_jid(jid) - else: - nickname = jid - - print "Event '%s' occured. Arguments: %s\n\n===\n"%(event_name, pformat(args)) - print "Event '%s' occured. Arguments: \naccount = %s\njid = %s\nmsg = %s\nnickname = %s"%( - event_name, account, jid, msg, nickname) - + def notif(self, obj): + print "Event '%s' occured.\n\n===\n" % obj.popup_event_type #if PySnarl.snGetVersion() != False: #(major, minor) = PySnarl.snGetVersion() #print "Found Snarl version",str(major)+"."+str(minor),"running." - #PySnarl.snShowMessage(nickname, msg[:20]+'...') + #PySnarl.snShowMessage(obj.popup_title, obj.popup_text) #else: #print "Sorry Snarl does not appear to be running" |