gave sessionless window location its own method

This commit is contained in:
Brendan Taylor 2008-05-29 02:48:55 +00:00
parent 45fe866240
commit bcf7018fce
2 changed files with 17 additions and 11 deletions

View File

@ -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

View File

@ -182,16 +182,11 @@ 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]
ctrl = gajim.interface.msg_win_mgr.get_sessionless_ctrl(jid, self.conn.name)
if ctrl:
self.control = ctrl
ctrl.set_session(self)
ctrl.parent_win.move_from_sessionless(ctrl)
self.control.set_session(self)
self.control.parent_win.move_from_sessionless(self.control)
first = False
if pm: