Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYann Leboulanger <asterix@lagaule.org>2012-06-19 21:19:24 +0400
committerYann Leboulanger <asterix@lagaule.org>2012-06-19 21:19:24 +0400
commit449f137dd744e3e0c2292deccf5ab134ff092006 (patch)
tree3e1c93de53ed2745d75f5030c6dc5bdd993a3c9f /src/common/xmpp
parenta51bf035cd535ebcba9e4efe4f9b798c8de02ab9 (diff)
correctly handle see-other-host (earlier in the connection process). Fixes #7179
Diffstat (limited to 'src/common/xmpp')
-rw-r--r--src/common/xmpp/client_nb.py11
-rw-r--r--src/common/xmpp/dispatcher_nb.py3
2 files changed, 11 insertions, 3 deletions
diff --git a/src/common/xmpp/client_nb.py b/src/common/xmpp/client_nb.py
index 97d5ec567..33db82939 100644
--- a/src/common/xmpp/client_nb.py
+++ b/src/common/xmpp/client_nb.py
@@ -67,6 +67,7 @@ class NonBlockingClient:
self.on_connect_failure = None
self.proxy = None
self.got_features = False
+ self.got_see_other_host = None
self.stream_started = False
self.disconnecting = False
self.protocol_type = 'XMPP'
@@ -138,8 +139,8 @@ class NonBlockingClient:
self.disconnecting = False
def connect(self, on_connect, on_connect_failure, hostname=None, port=5222,
- on_proxy_failure=None, proxy=None, secure_tuple=('plain', None,
- None)):
+ on_proxy_failure=None, on_stream_error_cb=None, proxy=None,
+ secure_tuple=('plain', None, None)):
"""
Open XMPP connection (open XML streams in both directions)
@@ -161,6 +162,7 @@ class NonBlockingClient:
self.on_connect = on_connect
self.on_connect_failure=on_connect_failure
self.on_proxy_failure = on_proxy_failure
+ self.on_stream_error_cb = on_stream_error_cb
self.desired_security, self.cacerts, self.mycerts = secure_tuple
self.Connection = None
self.Port = port
@@ -350,7 +352,10 @@ class NonBlockingClient:
# sometimes <features> are received together with document
# attributes and sometimes on next receive...
self.Dispatcher.ProcessNonBlocking(data)
- if not self.got_features:
+ if self.got_see_other_host:
+ log.info('got see-other-host')
+ self.on_stream_error_cb(self, self.got_see_other_host)
+ elif not self.got_features:
self._xmpp_connect_machine(
mode='FAILURE',
data='Missing <features> in 1.0 stream')
diff --git a/src/common/xmpp/dispatcher_nb.py b/src/common/xmpp/dispatcher_nb.py
index 37020e5c6..5c4a7a1c9 100644
--- a/src/common/xmpp/dispatcher_nb.py
+++ b/src/common/xmpp/dispatcher_nb.py
@@ -415,6 +415,9 @@ class XMPPDispatcher(PlugIn):
if name == 'features':
self._owner.got_features = True
session.Stream.features = stanza
+ if name == 'error':
+ if stanza.getTag('see-other-host'):
+ self._owner.got_see_other_host = stanza
xmlns = stanza.getNamespace()