From fc88ae004a251da0cad455f752566b61bc9e5d10 Mon Sep 17 00:00:00 2001 From: junglecow Date: Fri, 24 Nov 2006 14:48:04 +0000 Subject: [PATCH] When registering a new account, instead of using on_connect_success handler, register disconnect handler with the connection as soon as we create it. Hacky, but works. Fixes #2671. --- src/common/connection.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/connection.py b/src/common/connection.py index 35ce26b6d..8008358d5 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -363,6 +363,11 @@ class Connection(ConnectionHandlers): host = self.select_next_host(self._hosts) self._current_host = host self._hosts.remove(host) + + # FIXME: this is a hack; need a better way + if self.on_connect_success == self._on_new_account: + con.RegisterDisconnectHandler(self._on_new_account) + con.connect((host['host'], host['port']), proxy = self._proxy, secure = self._secure) return @@ -867,8 +872,8 @@ class Connection(ConnectionHandlers): return self.on_connect_failure = None self.connection = con - if con: - con.RegisterDisconnectHandler(self._on_new_account) + #if con: + # con.RegisterDisconnectHandler(self._on_new_account) common.xmpp.features_nb.getRegInfo(con, self._hostname) def account_changed(self, new_name):