clean code and fix a bug with names that contain a @ char
This commit is contained in:
parent
b8a87be784
commit
f219f1d24c
|
@ -479,24 +479,18 @@ class FileTransfersTooltip(BaseTooltip):
|
||||||
text += '\n<b>' + _('Type: ') + '</b>'
|
text += '\n<b>' + _('Type: ') + '</b>'
|
||||||
if file_props['type'] == 'r':
|
if file_props['type'] == 'r':
|
||||||
text += _('Download')
|
text += _('Download')
|
||||||
else:
|
|
||||||
text += _('Upload')
|
|
||||||
if file_props['type'] == 'r':
|
|
||||||
text += '\n<b>' + _('Sender: ') + '</b>'
|
text += '\n<b>' + _('Sender: ') + '</b>'
|
||||||
sender = unicode(file_props['sender']).split('/')[0]
|
sender = unicode(file_props['sender']).split('/')[0]
|
||||||
name = gajim.contacts.get_first_contact_from_jid(
|
name = gajim.contacts.get_first_contact_from_jid(
|
||||||
file_props['tt_account'], sender).get_shown_name()
|
file_props['tt_account'], sender).get_shown_name()
|
||||||
else:
|
else:
|
||||||
|
text += _('Upload')
|
||||||
text += '\n<b>' + _('Recipient: ') + '</b>'
|
text += '\n<b>' + _('Recipient: ') + '</b>'
|
||||||
receiver = file_props['receiver']
|
receiver = file_props['receiver']
|
||||||
if hasattr(receiver, 'name'):
|
if hasattr(receiver, 'name'):
|
||||||
receiver = receiver.name
|
name = receiver.get_shown_name()
|
||||||
receiver = receiver.split('/')[0]
|
|
||||||
if receiver.find('@') == -1:
|
|
||||||
name = receiver
|
|
||||||
else:
|
else:
|
||||||
name = gajim.contacts.get_first_contact_from_jid(
|
name = receiver.split('/')[0]
|
||||||
file_props['tt_account'], receiver).get_shown_name()
|
|
||||||
text += gtkgui_helpers.escape_for_pango_markup(name)
|
text += gtkgui_helpers.escape_for_pango_markup(name)
|
||||||
text += '\n<b>' + _('Size: ') + '</b>'
|
text += '\n<b>' + _('Size: ') + '</b>'
|
||||||
text += helpers.convert_bytes(file_props['size'])
|
text += helpers.convert_bytes(file_props['size'])
|
||||||
|
|
Loading…
Reference in New Issue