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.
This commit is contained in:
parent
e0f2ec0915
commit
fc88ae004a
1 changed files with 7 additions and 2 deletions
|
@ -363,6 +363,11 @@ class Connection(ConnectionHandlers):
|
||||||
host = self.select_next_host(self._hosts)
|
host = self.select_next_host(self._hosts)
|
||||||
self._current_host = host
|
self._current_host = host
|
||||||
self._hosts.remove(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,
|
con.connect((host['host'], host['port']), proxy = self._proxy,
|
||||||
secure = self._secure)
|
secure = self._secure)
|
||||||
return
|
return
|
||||||
|
@ -867,8 +872,8 @@ class Connection(ConnectionHandlers):
|
||||||
return
|
return
|
||||||
self.on_connect_failure = None
|
self.on_connect_failure = None
|
||||||
self.connection = con
|
self.connection = con
|
||||||
if con:
|
#if con:
|
||||||
con.RegisterDisconnectHandler(self._on_new_account)
|
# con.RegisterDisconnectHandler(self._on_new_account)
|
||||||
common.xmpp.features_nb.getRegInfo(con, self._hostname)
|
common.xmpp.features_nb.getRegInfo(con, self._hostname)
|
||||||
|
|
||||||
def account_changed(self, new_name):
|
def account_changed(self, new_name):
|
||||||
|
|
Loading…
Add table
Reference in a new issue