From a9262c4e0a4c23f0ef596feda968dfa25c04b3d2 Mon Sep 17 00:00:00 2001 From: Nathan Fritz Date: Tue, 16 Jun 2009 11:59:55 +0000 Subject: * bugfixes --- sleekxmpp/__init__.py | 6 +++++- sleekxmpp/basexmpp.py | 4 ++-- sleekxmpp/plugins/xep_0060.py | 2 -- sleekxmpp/xmlstream/xmlstream.py | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) (limited to 'sleekxmpp') diff --git a/sleekxmpp/__init__.py b/sleekxmpp/__init__.py index d7eff574..ddd93fe1 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 ae2b063f..1f074910 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 015c2210..b5e338ad 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 ad2c5a1c..e5d5f583 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) -- cgit v1.2.3