mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-24 03:00:15 +00:00
* fixed unhandled iqs
This commit is contained in:
parent
07018c0afa
commit
805afa4bc1
3 changed files with 12 additions and 13 deletions
|
@ -65,21 +65,19 @@ class Iq(StanzaBase):
|
||||||
return ns
|
return ns
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
def reply(self):
|
||||||
|
self['type'] = 'result'
|
||||||
|
StanzaBase.reply(self)
|
||||||
|
return self
|
||||||
|
|
||||||
def delQuery(self):
|
def delQuery(self):
|
||||||
for child in self.getchildren():
|
for child in self.getchildren():
|
||||||
if child.tag.endswith('query'):
|
if child.tag.endswith('query'):
|
||||||
self.xml.remove(child)
|
self.xml.remove(child)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def unhandled(self):
|
|
||||||
pass
|
|
||||||
# returned unhandled error
|
|
||||||
|
|
||||||
def exception(self, traceback=None):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def send(self, block=True, timeout=10):
|
def send(self, block=True, timeout=10):
|
||||||
if block:
|
if block and self['type'] in ('get', 'set'):
|
||||||
waitfor = Waiter('IqWait_%s' % self['id'], MatcherId(self['id']))
|
waitfor = Waiter('IqWait_%s' % self['id'], MatcherId(self['id']))
|
||||||
self.stream.registerHandler(waitfor)
|
self.stream.registerHandler(waitfor)
|
||||||
StanzaBase.send(self)
|
StanzaBase.send(self)
|
||||||
|
|
|
@ -214,8 +214,8 @@ class StanzaBase(ElementBase):
|
||||||
def clear(self):
|
def clear(self):
|
||||||
for child in self.xml.getchildren():
|
for child in self.xml.getchildren():
|
||||||
self.xml.remove(child)
|
self.xml.remove(child)
|
||||||
for plugin in self.plugins:
|
#for plugin in list(self.plugins.keys()):
|
||||||
del self.plugins[plugin]
|
# del self.plugins[plugin]
|
||||||
|
|
||||||
def reply(self):
|
def reply(self):
|
||||||
self['from'], self['to'] = self['to'], self['from']
|
self['from'], self['to'] = self['to'], self['from']
|
||||||
|
|
|
@ -257,14 +257,15 @@ class XMLStream(object):
|
||||||
break
|
break
|
||||||
if stanza is None:
|
if stanza is None:
|
||||||
stanza = StanzaBase(self, xmlobj)
|
stanza = StanzaBase(self, xmlobj)
|
||||||
|
unhandled = True
|
||||||
for handler in self.__handlers:
|
for handler in self.__handlers:
|
||||||
if handler.match(xmlobj):
|
if handler.match(xmlobj):
|
||||||
handler.prerun(stanza)
|
handler.prerun(stanza)
|
||||||
self.eventqueue.put(('stanza', handler, stanza))
|
self.eventqueue.put(('stanza', handler, stanza))
|
||||||
if handler.checkDelete(): self.__handlers.pop(self.__handlers.index(handler))
|
if handler.checkDelete(): self.__handlers.pop(self.__handlers.index(handler))
|
||||||
else:
|
unhandled = False
|
||||||
stanza.unhandled()
|
if unhandled:
|
||||||
|
stanza.unhandled()
|
||||||
#loop through handlers and test match
|
#loop through handlers and test match
|
||||||
#spawn threads as necessary, call handlers, sending Stanza
|
#spawn threads as necessary, call handlers, sending Stanza
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue