summaryrefslogtreecommitdiff
path: root/sleekxmpp/__init__.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-06-02 15:57:18 -0400
committerLance Stout <lancestout@gmail.com>2010-06-02 15:57:18 -0400
commit6469cdb4ca4b94b9154d7efb408aba3a7a7b42e4 (patch)
treeae0bdcce7b02e0a11231f8fff44f925adb7fc5cd /sleekxmpp/__init__.py
parentf5cae85af5c2f9c79ade1e6413436c1206689bdd (diff)
parent18e27d65ce47d877d6b2c810979df640aba7d8ba (diff)
downloadslixmpp-6469cdb4ca4b94b9154d7efb408aba3a7a7b42e4.tar.gz
slixmpp-6469cdb4ca4b94b9154d7efb408aba3a7a7b42e4.tar.bz2
slixmpp-6469cdb4ca4b94b9154d7efb408aba3a7a7b42e4.tar.xz
slixmpp-6469cdb4ca4b94b9154d7efb408aba3a7a7b42e4.zip
Merge branch 'develop' of git://github.com/fritzy/SleekXMPP into develop
Diffstat (limited to 'sleekxmpp/__init__.py')
-rw-r--r--sleekxmpp/__init__.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py
index 263f1f99..ccb43522 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -66,6 +66,8 @@ class ClientXMPP(basexmpp, XMLStream):
#TODO: Use stream state here
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))
@@ -221,19 +223,23 @@ class ClientXMPP(basexmpp, XMLStream):
response = iq.send()
#response = self.send(iq, self.Iq(sid=iq['id']))
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")
def handler_start_session(self, xml):
- if self.authenticated:
+ if self.authenticated and self.bound:
iq = self.makeIqSet(xml)
response = iq.send()
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):