From d68eab4a6e7c050b6b02aed8c3a0de2070313fba Mon Sep 17 00:00:00 2001 From: Yann Leboulanger <asterix@lagaule.org> Date: Thu, 22 Sep 2011 11:43:51 +0200 Subject: [PATCH] show our room nickname when chatting in pm. Fixes #6949 --- src/chat_control.py | 7 +++++-- src/groupchat_control.py | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 7d52523945..511a21bbcb 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -2371,6 +2371,9 @@ class ChatControl(ChatControlBase): elif isinstance(self.session, ArchivingStanzaSession): self.print_archiving_session_details() + def get_our_nick(self): + return gajim.nicks[self.account] + def print_conversation(self, text, frm='', tim=None, encrypted=False, subject=None, xhtml=None, simple=False, xep0184_id=None, displaymarking=None): @@ -2427,7 +2430,7 @@ class ChatControl(ChatControlBase): name = contact.get_shown_name() else: kind = 'outgoing' - name = gajim.nicks[self.account] + name = self.get_our_nick() if not xhtml and not (encrypted and self.gpg_is_active) and \ gajim.config.get('rst_formatting_outgoing_messages'): from common.rst_xhtml_generator import create_xhtml @@ -2876,7 +2879,7 @@ class ChatControl(ChatControlBase): if row[1] in (constants.KIND_CHAT_MSG_SENT, constants.KIND_SINGLE_MSG_SENT): kind = 'outgoing' - name = gajim.nicks[self.account] + name = self.get_our_nick() elif row[1] in (constants.KIND_SINGLE_MSG_RECV, constants.KIND_CHAT_MSG_RECV): kind = 'incoming' diff --git a/src/groupchat_control.py b/src/groupchat_control.py index afa873b538..be84c4cb8a 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -138,12 +138,12 @@ class PrivateChatControl(ChatControl): def __init__(self, parent_win, gc_contact, contact, account, session): room_jid = gc_contact.room_jid - room_ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid, + self.room_ctrl = gajim.interface.msg_win_mgr.get_gc_control(room_jid, account) if room_jid in gajim.interface.minimized_controls[account]: - room_ctrl = gajim.interface.minimized_controls[account][room_jid] - if room_ctrl: - self.room_name = room_ctrl.name + self.room_ctrl = gajim.interface.minimized_controls[account][room_jid] + if self.room_ctrl: + self.room_name = self.room_ctrl.name else: self.room_name = room_jid self.gc_contact = gc_contact @@ -154,6 +154,9 @@ class PrivateChatControl(ChatControl): gajim.ged.register_event_handler('gc-presence-received', ged.GUI1, self._nec_gc_presence_received) + def get_our_nick(self): + return self.room_ctrl.nick + def shutdown(self): super(PrivateChatControl, self).shutdown() gajim.ged.remove_event_handler('caps-received', ged.GUI1, -- GitLab