mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-12-28 11:14:19 +00:00
* bugfixes
This commit is contained in:
parent
5fbf0f84d7
commit
a9262c4e0a
4 changed files with 11 additions and 6 deletions
|
@ -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")
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue