diff options
author | Nathan Fritz <nathan@andyet.net> | 2010-06-01 21:40:52 -0700 |
---|---|---|
committer | Nathan Fritz <nathan@andyet.net> | 2010-06-01 21:40:52 -0700 |
commit | f5491c901ff7de5fc16bdb0b6c9d64fba67e5460 (patch) | |
tree | e8e6fd6485dd77fd16c8d7393e016229c614bb13 /sleekxmpp | |
parent | 1e3a6e1b5f06d307295be6b4ccaf75bf2a48399d (diff) | |
download | slixmpp-f5491c901ff7de5fc16bdb0b6c9d64fba67e5460.tar.gz slixmpp-f5491c901ff7de5fc16bdb0b6c9d64fba67e5460.tar.bz2 slixmpp-f5491c901ff7de5fc16bdb0b6c9d64fba67e5460.tar.xz slixmpp-f5491c901ff7de5fc16bdb0b6c9d64fba67e5460.zip |
if binding and session are advertised in the same go, do session first
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py index 263f1f99..8376bdce 100644 --- a/sleekxmpp/__init__.py +++ b/sleekxmpp/__init__.py @@ -66,6 +66,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)) @@ -221,6 +222,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") @@ -228,7 +230,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") |