summaryrefslogtreecommitdiff
path: root/sleekxmpp/__init__.py
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-06-02 12:40:52 +0800
committerThom Nichols <tmnichols@gmail.com>2010-06-03 01:30:23 +0800
commitb03e6168a8131330390df35572345bfe07ba73fa (patch)
tree59f6ebb6ddc385b10bbe07cf3a721c5103e65caf /sleekxmpp/__init__.py
parent2a43f59a588af7206b0d1935e85fbb9577b3c200 (diff)
downloadslixmpp-b03e6168a8131330390df35572345bfe07ba73fa.tar.gz
slixmpp-b03e6168a8131330390df35572345bfe07ba73fa.tar.bz2
slixmpp-b03e6168a8131330390df35572345bfe07ba73fa.tar.xz
slixmpp-b03e6168a8131330390df35572345bfe07ba73fa.zip
if binding and session are advertised in the same go, do session first
Diffstat (limited to 'sleekxmpp/__init__.py')
-rw-r--r--sleekxmpp/__init__.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py
index 6995f7c9..9297ad3f 100644
--- a/sleekxmpp/__init__.py
+++ b/sleekxmpp/__init__.py
@@ -69,6 +69,7 @@ class ClientXMPP(basexmpp, XMLStream):
#TODO: Use stream state here
self.authenticated = False
self.sessionstarted = False
+ self.bound = 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))
@@ -248,6 +249,7 @@ 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:
logging.debug("Established Session")
@@ -255,7 +257,7 @@ class ClientXMPP(basexmpp, XMLStream):
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")