show account name in chat banner if a contact in another account have the same nick. Fixes #2031
This commit is contained in:
parent
3df7e1b84f
commit
fd0a9e863f
|
@ -880,8 +880,6 @@ class ChatControl(ChatControlBase):
|
||||||
self.update_ui()
|
self.update_ui()
|
||||||
# restore previous conversation
|
# restore previous conversation
|
||||||
self.restore_conversation()
|
self.restore_conversation()
|
||||||
# is account displayed after nick in banner ?
|
|
||||||
self.account_displayed= False
|
|
||||||
|
|
||||||
def notify_on_new_messages(self):
|
def notify_on_new_messages(self):
|
||||||
return gajim.config.get('trayicon_notification_on_new_messages')
|
return gajim.config.get('trayicon_notification_on_new_messages')
|
||||||
|
@ -1000,10 +998,8 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
banner_name_label = self.xml.get_widget('banner_name_label')
|
banner_name_label = self.xml.get_widget('banner_name_label')
|
||||||
name = contact.get_shown_name()
|
name = contact.get_shown_name()
|
||||||
avoid_showing_account_too = False
|
|
||||||
if self.resource:
|
if self.resource:
|
||||||
name += '/' + self.resource
|
name += '/' + self.resource
|
||||||
avoid_showing_account_too = True
|
|
||||||
if self.TYPE_ID == message_control.TYPE_PM:
|
if self.TYPE_ID == message_control.TYPE_PM:
|
||||||
room_jid = self.contact.jid.split('/')[0]
|
room_jid = self.contact.jid.split('/')[0]
|
||||||
room_ctrl = gajim.interface.msg_win_mgr.get_control(room_jid,
|
room_ctrl = gajim.interface.msg_win_mgr.get_control(room_jid,
|
||||||
|
@ -1011,23 +1007,21 @@ class ChatControl(ChatControlBase):
|
||||||
name = _('%s from room %s') % (name, room_ctrl.name)
|
name = _('%s from room %s') % (name, room_ctrl.name)
|
||||||
name = gtkgui_helpers.escape_for_pango_markup(name)
|
name = gtkgui_helpers.escape_for_pango_markup(name)
|
||||||
|
|
||||||
# We know our contacts nick, but if there are any other controls
|
# We know our contacts nick, but if another contact has the same nick
|
||||||
# with the same nick we need to also display the account
|
# in another account we need to also display the account.
|
||||||
# except if we are talking to two different resources of the same contact
|
# except if we are talking to two different resources of the same contact
|
||||||
acct_info = ''
|
acct_info = ''
|
||||||
self.account_displayed = False
|
for account in gajim.contacts.get_accounts():
|
||||||
for ctrl in self.parent_win.controls():
|
if account == self.account:
|
||||||
if ctrl == self or ctrl.type_id == 'gc':
|
|
||||||
continue
|
continue
|
||||||
if self.contact.get_shown_name() == ctrl.contact.get_shown_name()\
|
if acct_info: # We already found a contact with same nick
|
||||||
and not avoid_showing_account_too:
|
|
||||||
self.account_displayed = True
|
|
||||||
if not ctrl.account_displayed:
|
|
||||||
# do that after this instance exists
|
|
||||||
gobject.idle_add(ctrl.draw_banner)
|
|
||||||
acct_info = ' (%s)' % \
|
|
||||||
gtkgui_helpers.escape_for_pango_markup(self.account)
|
|
||||||
break
|
break
|
||||||
|
for jid in gajim.contacts.get_jid_list(account):
|
||||||
|
contact = gajim.contacts.get_first_contact_from_jid(account, jid)
|
||||||
|
if contact.get_shown_name() == self.contact.get_shown_name():
|
||||||
|
acct_info = ' (%s)' % \
|
||||||
|
gtkgui_helpers.escape_for_pango_markup(self.account)
|
||||||
|
break
|
||||||
|
|
||||||
status = contact.status
|
status = contact.status
|
||||||
if status is not None:
|
if status is not None:
|
||||||
|
|
Loading…
Reference in New Issue