diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py index d7eff57..ddd93fe 100644 --- a/sleekxmpp/__init__.py +++ b/sleekxmpp/__init__.py @@ -81,7 +81,7 @@ class ClientXMPP(basexmpp, XMLStream): self.registerFeature("", self.handler_starttls, True) self.registerFeature("", self.handler_sasl_auth, True) self.registerFeature("", self.handler_bind_resource) - self.registerFeature("", self.handler_start_session) + #self.registerFeature("", self.handler_start_session) #self.registerStanzaExtension('PresenceStanza', PresenceStanzaType) #self.register_plugins() @@ -242,8 +242,12 @@ class ClientXMPP(basexmpp, XMLStream): response = self.send(out, self.makeIqResult(id)) self.set_jid(response.find('{urn:ietf:params:xml:ns:xmpp-bind}bind/{urn:ietf:params:xml:ns:xmpp-bind}jid').text) logging.info("Node set to: %s" % self.fulljid) + logging.debug("Established Session") + self.sessionstarted = True + self.event("session_start") def handler_start_session(self, xml): + "deprecated" if self.authenticated: response = self.send(self.makeIqSet(xml), self.makeIq(self.getId())) logging.debug("Established Session") diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py index ae2b063..1f07491 100644 --- a/sleekxmpp/basexmpp.py +++ b/sleekxmpp/basexmpp.py @@ -92,8 +92,8 @@ class basexmpp(object): self.auto_subscribe = True self.event_handlers = {} self.roster = {} - self.registerHandler(Callback('IM', MatchMany((MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns))), self._handleMessage)) - self.registerHandler(Callback('Presence', MatchMany((MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns))), self._handlePresence)) + self.registerHandler(Callback('IM', MatchMany((MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns))), self._handleMessage, thread=False)) + self.registerHandler(Callback('Presence', MatchMany((MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns))), self._handlePresence, thread=False)) self.registerHandler(Callback('PresenceSubscribe', MatchMany((MatchXMLMask("" % self.default_ns),MatchXMLMask("" % self.default_ns))), self._handlePresenceSubscribe)) def set_jid(self, jid): diff --git a/sleekxmpp/plugins/xep_0060.py b/sleekxmpp/plugins/xep_0060.py index 015c221..b5e338a 100644 --- a/sleekxmpp/plugins/xep_0060.py +++ b/sleekxmpp/plugins/xep_0060.py @@ -160,8 +160,6 @@ class xep_0060(base.base_plugin): subs[sub.get('jid')] = sub.get('affiliation') return subs - - def deleteNode(self, jid, node): pubsub = ET.Element('{http://jabber.org/protocol/pubsub#owner}pubsub') iq = self.xmpp.makeIqSet() diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index ad2c5a1..e5d5f58 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -194,8 +194,11 @@ class XMLStream(object): except KeyboardInterrupt: logging.debug("Keyboard Escape Detected") self.state.set('processing', False) + self.state.set('reconnect', False) self.disconnect() raise + except CloseStream: + break except: self.state.set('processing', False) traceback.print_exc() @@ -263,7 +266,7 @@ class XMLStream(object): except socket.error,(errno,strerror): logging.warning("Error while disconnecting. Socket Error #%s: %s" % (errno, strerror)) if self.state['processing']: - raise + raise CloseStream def reconnect(self): self.state.set('tls',False)