diff options
author | Lance Stout <lancestout@gmail.com> | 2010-08-27 16:42:26 -0400 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2010-08-27 16:42:26 -0400 |
commit | 89fb15e8962640a34e24418216e156188032bfa8 (patch) | |
tree | 9a510aef8469c2162456258c6063e21b36a66e07 /sleekxmpp/xmlstream/xmlstream.py | |
parent | 906aa0bd6896d119bcbabc6e21de31c2171316b9 (diff) | |
download | slixmpp-89fb15e8962640a34e24418216e156188032bfa8.tar.gz slixmpp-89fb15e8962640a34e24418216e156188032bfa8.tar.bz2 slixmpp-89fb15e8962640a34e24418216e156188032bfa8.tar.xz slixmpp-89fb15e8962640a34e24418216e156188032bfa8.zip |
Updated the suite of handler classes with documentation.
Updated XMLStream to return True or False from removeHandler to indicate if the handler
existed and was removed.
Waiter handlers now unregister themselves after timing out.
Diffstat (limited to 'sleekxmpp/xmlstream/xmlstream.py')
-rw-r--r-- | sleekxmpp/xmlstream/xmlstream.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py index 415567e2..28aee2b4 100644 --- a/sleekxmpp/xmlstream/xmlstream.py +++ b/sleekxmpp/xmlstream/xmlstream.py @@ -357,8 +357,10 @@ class XMLStream(object): return False def registerHandler(self, handler, before=None, after=None): - "Add handler with matcher class and parameters." - self.__handlers.append(handler) + "Add handler with matcher class and parameters." + if handler.stream is None: + self.__handlers.append(handler) + handler.stream = self def removeHandler(self, name): "Removes the handler." @@ -366,8 +368,10 @@ class XMLStream(object): for handler in self.__handlers: if handler.name == name: self.__handlers.pop(idx) - return + return True idx += 1 + return False + def registerStanza(self, stanza_class): "Adds stanza. If root stanzas build stanzas sent in events while non-root stanzas build substanza objects." |