summaryrefslogtreecommitdiff
path: root/sleekxmpp/basexmpp.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-06-22 23:17:15 -0700
committerLance Stout <lancestout@gmail.com>2012-06-22 23:17:15 -0700
commit5d6019a962fd1a30ed04520892836cdecc7fe19f (patch)
tree6ee7b956a813af2f0507867dc861f4aead3479e2 /sleekxmpp/basexmpp.py
parenteb5df1aa3722e6e85b9683805b4088f4340918aa (diff)
parent85ef2d8d0bcc92cd20d857d01bcf1bba56bc8edf (diff)
downloadslixmpp-5d6019a962fd1a30ed04520892836cdecc7fe19f.tar.gz
slixmpp-5d6019a962fd1a30ed04520892836cdecc7fe19f.tar.bz2
slixmpp-5d6019a962fd1a30ed04520892836cdecc7fe19f.tar.xz
slixmpp-5d6019a962fd1a30ed04520892836cdecc7fe19f.zip
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r--sleekxmpp/basexmpp.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index aae80168..275275d1 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -134,6 +134,7 @@ class BaseXMPP(XMLStream):
Callback('Presence',
MatchXPath("{%s}presence" % self.default_ns),
self._handle_presence))
+
self.register_handler(
Callback('Stream Error',
MatchXPath("{%s}error" % self.stream_ns),
@@ -658,6 +659,27 @@ class BaseXMPP(XMLStream):
def _handle_stream_error(self, error):
self.event('stream_error', error)
+ if error['condition'] == 'see-other-host':
+ other_host = error['see_other_host']
+
+ host = other_host
+ port = 5222
+
+ if '[' in other_host and ']' in other_host:
+ host = other_host.split(']')[0][1:]
+ elif ':' in other_host:
+ host = other_host.split(':')[0]
+
+ port_sec = other_host.split(']')[-1]
+ if ':' in port_sec:
+ port = int(port_sec.split(':')[1])
+
+ self.address = (host, port)
+ self.default_domain = host
+ self.dns_records = None
+ self.reconnect_delay = None
+ self.reconnect()
+
def _handle_message(self, msg):
"""Process incoming message stanzas."""
if not self.is_component and not msg['to'].bare: