From f5ae955764f60a7ef00da5eafe1398197a7086c2 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 2 Nov 2008 14:31:11 +0000 Subject: [PATCH] show bookmark title instead of jid in tabs and roster. Fixes #4420 --- src/groupchat_control.py | 8 +++++++- src/roster_window.py | 13 +++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/groupchat_control.py b/src/groupchat_control.py index c1a648035..7480fd7f6 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -228,7 +228,13 @@ class GroupchatControl(ChatControlBase): self.room_jid = self.contact.jid self.nick = contact.name.decode('utf-8') self.new_nick = '' - self.name = self.room_jid.split('@')[0] + self.name = '' + for bm in gajim.connections[self.account].bookmarks: + if bm['jid'] == self.room_jid: + self.name = bm['name'] + break + if not self.name: + self.name = self.room_jid.split('@')[0] compact_view = gajim.config.get('compact_view') self.chat_buttons_set_visible(compact_view) diff --git a/src/roster_window.py b/src/roster_window.py index 665344db3..5d2732f7c 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -795,14 +795,19 @@ class RosterWindow: status = '' if contact is None: - # New groupchat - contact = gajim.contacts.create_contact(jid=jid, name=jid, - groups=[_('Groupchats')], show=show, status=status, sub='none') - gajim.contacts.add_contact(account, contact) gc_control = gajim.interface.msg_win_mgr.get_gc_control(jid, account) if gc_control: # there is a window that we can minimize gajim.interface.minimized_controls[account][jid] = gc_control + name = gc_control.name + elif jid in gajim.interface.minimized_controls[account]: + name = gajim.interface.minimized_controls[account][jid].name + else: + name = jid.split('@')[0] + # New groupchat + contact = gajim.contacts.create_contact(jid=jid, name=name, + groups=[_('Groupchats')], show=show, status=status, sub='none') + gajim.contacts.add_contact(account, contact) self.add_contact(jid, account) else: contact.show = show