summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-06-02 12:44:54 +0800
committerThom Nichols <tmnichols@gmail.com>2010-06-03 01:30:24 +0800
commit85a2715c7de1f436b5553a73f74c30cffa8bc04f (patch)
treef07858132b74ded5904ae2c902b5a70dbf000cc3
parentb03e6168a8131330390df35572345bfe07ba73fa (diff)
downloadslixmpp-85a2715c7de1f436b5553a73f74c30cffa8bc04f.tar.gz
slixmpp-85a2715c7de1f436b5553a73f74c30cffa8bc04f.tar.bz2
slixmpp-85a2715c7de1f436b5553a73f74c30cffa8bc04f.tar.xz
slixmpp-85a2715c7de1f436b5553a73f74c30cffa8bc04f.zip
hack fix for session before bind
-rw-r--r--sleekxmpp/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py
index 9297ad3f..23e8c9b8 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -70,6 +70,7 @@ class ClientXMPP(basexmpp, XMLStream):
self.authenticated = False
self.sessionstarted = False
self.bound = False
+ self.bindfail = False
self.registerHandler(Callback('Stream Features', MatchXPath('{http://etherx.jabber.org/streams}features'), self._handleStreamFeatures, thread=True))
self.registerHandler(Callback('Roster Update', MatchXPath('{%s}iq/{jabber:iq:roster}query' % self.default_ns), self._handleRoster, thread=True))
#self.registerHandler(Callback('Roster Update', MatchXMLMask("<presence xmlns='%s' type='subscribe' />" % self.default_ns), self._handlePresenceSubscribe, thread=True))
@@ -251,7 +252,7 @@ class ClientXMPP(basexmpp, XMLStream):
self.set_jid(response.xml.find('{urn:ietf:params:xml:ns:xmpp-bind}bind/{urn:ietf:params:xml:ns:xmpp-bind}jid').text)
self.bound = True
logging.info("Node set to: %s" % self.fulljid)
- if "{urn:ietf:params:xml:ns:xmpp-session}session" not in self.features:
+ if "{urn:ietf:params:xml:ns:xmpp-session}session" not in self.features or self.bindfail:
logging.debug("Established Session")
self.sessionstarted = True
self.event("session_start")
@@ -263,6 +264,9 @@ class ClientXMPP(basexmpp, XMLStream):
logging.debug("Established Session")
self.sessionstarted = True
self.event("session_start")
+ else:
+ #bind probably hasn't happened yet
+ self.bindfail = True
def _handleRoster(self, iq, request=False):
if iq['type'] == 'set' or (iq['type'] == 'result' and request):