diff --git a/src/common/gajim.py b/src/common/gajim.py index 5450ba8bd..3cb285704 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -279,13 +279,14 @@ def get_notification_image_prefix(jid): prefix = 'jabber' return prefix -def get_actor(account, jid): - contact = contacts.get_first_contact_from_jid(account, jid) - if contact: - actor = contact.get_shown_name() - else: - actor = jid - return actor +def get_name_from_jid(account, jid): + '''returns from JID's shown name and if no contact returns jids''' + contact = contacts.get_first_contact_from_jid(account, jid) + if contact: + actor = contact.get_shown_name() + else: + actor = jid + return actor def popup_window(account): autopopup = config.get('autopopup') diff --git a/src/dialogs.py b/src/dialogs.py index 7440d88ee..51c39ab96 100644 --- a/src/dialogs.py +++ b/src/dialogs.py @@ -884,7 +884,7 @@ class PopupNotificationWindow: '%s' % event_type) if not text: - text = gajim.get_actor(account, jid) # default value of text + text = gajim.get_name_from_jid(account, jid) # default value of text # set colors [ http://www.pitt.edu/~nisg/cis/web/cgi/rgb.html ] self.window.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse('black')) diff --git a/src/gajim.py b/src/gajim.py index aa57941aa..7c9f6aad3 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -478,7 +478,7 @@ class Interface: elif gajim.connections[account].connected in (2, 3): # we're online or chat show_notification = True if show_notification: - txt = _('%s has sent you a new message.') % gajim.get_actor(account, jid) + txt = _('%s has sent you a new message.') % gajim.get_name_from_jid(account, jid) if msg_type == 'normal': # single message img = 'single_msg_recv.png' path = os.path.abspath(os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img)) @@ -965,7 +965,7 @@ class Interface: if gajim.show_notification(account): img = 'ft_request.png' path = os.path.abspath(os.path.join(gajim.DATA_DIR, 'pixmaps', 'events', img)) - txt = _('%s wants to send you a file.') % gajim.get_actor(account, jid) + txt = _('%s wants to send you a file.') % gajim.get_name_from_jid(account, jid) notify.notify(_('File Transfer Request'), jid, account, 'file-request', path_to_image = path, text = txt) def handle_event_file_progress(self, account, file_props): diff --git a/src/notify.py b/src/notify.py index e7160d2b0..4d85d80a8 100644 --- a/src/notify.py +++ b/src/notify.py @@ -107,7 +107,7 @@ class DesktopNotification: self.msg_type = msg_type if not text: - text = gajim.get_actor(account, jid) # default value of text + text = gajim.get_name_from_jid(account, jid) # default value of text if event_type == _('Contact Signed In'): ntype = 'presence.online'