From dc6b2968480cf82ff42d4c6e5dd0984651c1631a Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Tue, 3 Jan 2006 11:32:01 +0000 Subject: [PATCH] icon in notification window not always jabber now. MSN if he uses msn etc. thanks stian barmen for helping me test --- ...contact_offline.png => jabber_offline.png} | Bin .../{contact_online.png => jabber_online.png} | Bin src/common/gajim.py | 3 ++- src/notify.py | 24 +++++++++++++++--- 4 files changed, 23 insertions(+), 4 deletions(-) rename data/pixmaps/events/{contact_offline.png => jabber_offline.png} (100%) rename data/pixmaps/events/{contact_online.png => jabber_online.png} (100%) diff --git a/data/pixmaps/events/contact_offline.png b/data/pixmaps/events/jabber_offline.png similarity index 100% rename from data/pixmaps/events/contact_offline.png rename to data/pixmaps/events/jabber_offline.png diff --git a/data/pixmaps/events/contact_online.png b/data/pixmaps/events/jabber_online.png similarity index 100% rename from data/pixmaps/events/contact_online.png rename to data/pixmaps/events/jabber_online.png diff --git a/src/common/gajim.py b/src/common/gajim.py index b72a88b7c..9c81956f0 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -189,7 +189,8 @@ def get_number_of_accounts(): return len(connections.keys()) def get_transport_name_from_jid(jid, use_config_setting = True): - '''returns 'aim', 'gg', 'irc' etc''' + '''returns 'aim', 'gg', 'irc' etc + if JID is not from transport returns None''' #FIXME: jid can be None! one TB I saw had this problem: # in the code block # it is a groupchat presence in handle_event_notify # jid was None. Yann why? diff --git a/src/notify.py b/src/notify.py index 2d9f6aa6e..3cb8dd037 100644 --- a/src/notify.py +++ b/src/notify.py @@ -56,7 +56,7 @@ def notify(event_type, jid, account, msg_type = '', file_props = None): DesktopNotification(event_type, jid, account, msg_type, file_props) return except dbus.dbus_bindings.DBusException, e: - # Connection to DBus failed, try popup + # Connection to D-Bus failed, try popup gajim.log.debug(str(e)) except TypeError, e: # This means that we sent the message incorrectly @@ -112,12 +112,30 @@ class DesktopNotification: actor = jid txt = actor # default value of txt + transport_name = gajim.get_transport_name_from_jid(jid) + + if transport_name in ('aim', 'icq', 'msn', 'yahoo'): + prefix = transport_name + else: + prefix = 'jabber' + ''' + if transport_name == 'aim': + prefix = 'aim' + elif transport_name == 'icq': + prefix = 'icq' + elif transport_name == 'msn': + prefix = 'msn' + elif transport_name == 'yahoo': + prefix = 'yahoo' + else: + prefix = 'jabber' + ''' if event_type == _('Contact Signed In'): - img = 'contact_online.png' + img = prefix + '_online.png' ntype = 'presence.online' elif event_type == _('Contact Signed Out'): - img = 'contact_offline.png' + img = prefix + '_offline.png' ntype = 'presence.offline' elif event_type in (_('New Message'), _('New Single Message'), _('New Private Message')):