diff --git a/src/groupchat_control.py b/src/groupchat_control.py index 340ec2267..002881357 100644 --- a/src/groupchat_control.py +++ b/src/groupchat_control.py @@ -130,7 +130,7 @@ class PrivateChatControl(ChatControl): COMMAND_HOST = PrivateChatCommands def __init__(self, parent_win, gc_contact, contact, account, session): - room_jid = contact.jid.split('/')[0] + room_jid = gc_contact.room_jid 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] diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 1c90e0159..ac9fa157e 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -609,8 +609,7 @@ def get_avatar_pixbuf_from_cache(fjid, use_local=True): # don't show avatar for the transport itself return None - room, nick = gajim.get_room_and_nick_from_fjid(jid) - if any(room in gajim.contacts.get_gc_list(acc) for acc in gajim.connections): + if any(jid in gajim.contacts.get_gc_list(acc) for acc in gajim.connections): is_groupchat_contact = True else: is_groupchat_contact = False diff --git a/src/gui_interface.py b/src/gui_interface.py index 6f5f06e4f..859b9a9d1 100644 --- a/src/gui_interface.py +++ b/src/gui_interface.py @@ -2640,40 +2640,36 @@ class Interface: mw.new_tab(gc_control) def new_private_chat(self, gc_contact, account, session=None): - contact = gc_contact.as_contact() - type_ = message_control.TYPE_PM - fjid = gc_contact.room_jid + '/' + gc_contact.name - conn = gajim.connections[account] - - if not session and fjid in conn.sessions: - sessions = [s for s in conn.sessions[fjid].values() if isinstance(s, ChatControlSession)] + if not session and gc_contact.get_full_jid() in conn.sessions: + sessions = [s for s in conn.sessions[gc_contact.get_full_jid()].values() + if isinstance(s, ChatControlSession)] # look for an existing session with a chat control for s in sessions: if s.control: session = s break - if not session and not len(sessions) == 0: # there are no sessions with chat controls, just take the first one session = sessions[0] - if not session: # couldn't find an existing ChatControlSession, just make a new one + session = conn.make_new_session(gc_contact.get_full_jid(), None, 'pm') - session = conn.make_new_session(fjid, None, 'pm') - + contact = gc_contact.as_contact() if not session.control: - mw = self.msg_win_mgr.get_window(fjid, account) - if not mw: - mw = self.msg_win_mgr.create_window(contact, account, type_) + message_window = self.msg_win_mgr.get_window(gc_contact.get_full_jid(), + account) + if not message_window: + message_window = self.msg_win_mgr.create_window(contact, account, + message_control.TYPE_PM) - session.control = PrivateChatControl(mw, gc_contact, contact, account, - session) - mw.new_tab(session.control) + session.control = PrivateChatControl(message_window, gc_contact, + contact, account, session) + message_window.new_tab(session.control) - if len(gajim.events.get_events(account, fjid)): + if gajim.events.get_events(account, gc_contact.get_full_jid()): # We call this here to avoid race conditions with widget validation session.control.read_queue()