From 7721abb2b1e3b7ff4d7ec5f58759f9ab1dbb0769 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Wed, 18 Jun 2008 04:11:11 +0000 Subject: [PATCH] fix handle_event() for pms and new_chat_from_jid() for existing chat controls --- src/gajim.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/gajim.py b/src/gajim.py index 4ba454228..ea26b4bf2 100755 --- a/src/gajim.py +++ b/src/gajim.py @@ -2312,13 +2312,13 @@ class Interface: event = gajim.events.get_first_event(account, jid, type_) if type_ == 'printed_pm': - session = event.parameters[0] + ctrl = event.parameters[0] elif type_ == 'pm': session = event.parameters[8] if session and session.control: ctrl = session.control - else: + elif not ctrl: room_jid = jid nick = resource gc_contact = gajim.contacts.get_gc_contact(account, room_jid, @@ -2723,19 +2723,19 @@ class Interface: contact = self.roster.add_to_not_in_the_roster(account, jid, resource=resource) - session = gajim.connections[account].get_or_create_session(fjid, None) - - if not self.msg_win_mgr.has_window(fjid, account): - session.control = self.new_chat(contact, account, - resource=resource, session=session) + if self.msg_win_mgr.has_window(fjid, account): + ctrl = self.msg_win_mgr.get_chat_controls(fjid, account)[0] + else: + ctrl = self.new_chat(contact, account, + resource=resource) if len(gajim.events.get_events(account, fjid)): - session.control.read_queue() + ctrl.read_queue() - mw = session.control.parent_win - mw.set_active_tab(session.control) + mw = ctrl.parent_win + mw.set_active_tab(ctrl) # For JEP-0172 if added_to_roster: - session.control.user_nick = gajim.nicks[account] + ctrl.user_nick = gajim.nicks[account] def on_open_chat_window(self, widget, contact, account, resource=None, session=None):