From bcf7018fce993ed08e38c869c59a1d62f625b9f9 Mon Sep 17 00:00:00 2001 From: Brendan Taylor Date: Thu, 29 May 2008 02:48:55 +0000 Subject: [PATCH] gave sessionless window location its own method --- src/message_window.py | 11 +++++++++++ src/session.py | 17 ++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/message_window.py b/src/message_window.py index 24aa59896..21c362af5 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -934,6 +934,17 @@ class MessageWindowMgr(gobject.GObject): return None + def get_sessionless_ctrl(self, acct, jid): + '''returns a ChatControl associated with jid, that doesn't have a + session attached''' + mw = self.get_window(jid, acct) + + if mw: + ctrls = mw.sessionless_controls(acct, jid) + + if len(ctrls): + return ctrls[0] + def has_window(self, jid, acct): return self.get_window(jid, acct) is not None diff --git a/src/session.py b/src/session.py index a49d16be2..28d9bcb26 100644 --- a/src/session.py +++ b/src/session.py @@ -182,17 +182,12 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession): if not self.control: # look for an existing chat control without a session - mw = gajim.interface.msg_win_mgr.get_window(jid, self.conn.name) - - if mw: - ctrls = mw.sessionless_controls(self.conn.name, jid) - - if len(ctrls): - ctrl = ctrls[0] - self.control = ctrl - ctrl.set_session(self) - ctrl.parent_win.move_from_sessionless(ctrl) - first = False + ctrl = gajim.interface.msg_win_mgr.get_sessionless_ctrl(jid, self.conn.name) + if ctrl: + self.control = ctrl + self.control.set_session(self) + self.control.parent_win.move_from_sessionless(self.control) + first = False if pm: nickname = resource