diff --git a/src/common/connection.py b/src/common/connection.py index 35ce26b6d360d07682041826a721fc8621f47b59..8008358d53ce648f5073427a435b9f85d10c58a9 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -363,6 +363,11 @@ def connect_to_next_host(self, retry = False): 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 @@ def _on_new_account(self, con = None, con_type = None): 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):