diff options
Diffstat (limited to 'sleekxmpp')
-rw-r--r-- | sleekxmpp/__init__.py | 6 | ||||
-rw-r--r-- | sleekxmpp/basexmpp.py | 4 | ||||
-rw-r--r-- | sleekxmpp/plugins/xep_0060.py | 2 | ||||
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 5 |
4 files changed, 11 insertions, 6 deletions
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("<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls' />", self.handler_starttls, True) self.registerFeature("<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl' />", self.handler_sasl_auth, True) self.registerFeature("<bind xmlns='urn:ietf:params:xml:ns:xmpp-bind' />", self.handler_bind_resource) - self.registerFeature("<session xmlns='urn:ietf:params:xml:ns:xmpp-session' />", self.handler_start_session) + #self.registerFeature("<session xmlns='urn:ietf:params:xml:ns:xmpp-session' />", 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("<message xmlns='%s' type='chat'><body /></message>" % self.default_ns),MatchXMLMask("<message xmlns='%s' type='normal'><body /></message>" % self.default_ns),MatchXMLMask("<message xmlns='%s' type='__None__'><body /></message>" % self.default_ns))), self._handleMessage)) - self.registerHandler(Callback('Presence', MatchMany((MatchXMLMask("<presence xmlns='%s' type='available'/>" % self.default_ns),MatchXMLMask("<presence xmlns='%s' type='__None__'/>" % self.default_ns),MatchXMLMask("<presence xmlns='%s' type='unavailable'/>" % self.default_ns))), self._handlePresence)) + self.registerHandler(Callback('IM', MatchMany((MatchXMLMask("<message xmlns='%s' type='chat'><body /></message>" % self.default_ns),MatchXMLMask("<message xmlns='%s' type='normal'><body /></message>" % self.default_ns),MatchXMLMask("<message xmlns='%s' type='__None__'><body /></message>" % self.default_ns))), self._handleMessage, thread=False)) + self.registerHandler(Callback('Presence', MatchMany((MatchXMLMask("<presence xmlns='%s' type='available'/>" % self.default_ns),MatchXMLMask("<presence xmlns='%s' type='__None__'/>" % self.default_ns),MatchXMLMask("<presence xmlns='%s' type='unavailable'/>" % self.default_ns))), self._handlePresence, thread=False)) self.registerHandler(Callback('PresenceSubscribe', MatchMany((MatchXMLMask("<presence xmlns='%s' type='subscribe'/>" % self.default_ns),MatchXMLMask("<presence xmlns='%s' type='unsubscribed'/>" % 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) |