summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-06-01 21:44:54 -0700
committerNathan Fritz <nathan@andyet.net>2010-06-01 21:44:54 -0700
commit0c39567f208db4938614e9723901037d8801fb25 (patch)
tree4aeec55c488b04261a62f67681aa639bf4c8365d
parentf5491c901ff7de5fc16bdb0b6c9d64fba67e5460 (diff)
downloadslixmpp-0c39567f208db4938614e9723901037d8801fb25.tar.gz
slixmpp-0c39567f208db4938614e9723901037d8801fb25.tar.bz2
slixmpp-0c39567f208db4938614e9723901037d8801fb25.tar.xz
slixmpp-0c39567f208db4938614e9723901037d8801fb25.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 8376bdce..ccb43522 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -67,6 +67,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))
@@ -224,7 +225,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")
@@ -236,6 +237,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):