summaryrefslogtreecommitdiff
path: root/sleekxmpp/xmlstream/xmlstream.py
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@netflint.net>2009-12-17 01:54:22 +0000
committerNathan Fritz <fritzy@netflint.net>2009-12-17 01:54:22 +0000
commit07018c0afa7485b06424bf6787d242e7ee523d34 (patch)
tree5de2ae3309eb439b96d4dc5ce62abf00597f75f3 /sleekxmpp/xmlstream/xmlstream.py
parent6897a0b57c299cff9e32fde4dcb4209e70fb4bcb (diff)
downloadslixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.gz
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.bz2
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.tar.xz
slixmpp-07018c0afa7485b06424bf6787d242e7ee523d34.zip
* fixed many stanza bugs
* added stanza unhandled (unhandled iqs now reply with feature-not-implemented) * added stanza exceptions (stanzas may now reply with exceptions when their handler raises an exception)
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index e6107642..73729031 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -262,6 +262,8 @@ class XMLStream(object):
handler.prerun(stanza)
self.eventqueue.put(('stanza', handler, stanza))
if handler.checkDelete(): self.__handlers.pop(self.__handlers.index(handler))
+ else:
+ stanza.unhandled()
#loop through handlers and test match
#spawn threads as necessary, call handlers, sending Stanza
@@ -274,10 +276,18 @@ class XMLStream(object):
except queue.Empty:
event = None
if event is not None:
- etype, handler, stanza = event
+ etype, handler, *args = event
if etype == 'stanza':
- handler.run(stanza)
- if etype == 'quit':
+ try:
+ handler.run(args[0])
+ except:
+ args[0].exception(traceback.format_exc())
+ elif etype == 'sched':
+ try:
+ handler.run(*args)
+ except:
+ logging.error(traceback.format_exc())
+ elif etype == 'quit':
logging.debug("Quitting eventRunner thread")
return False