summaryrefslogtreecommitdiff
path: root/sleekxmpp/basexmpp.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-07-19 19:19:33 -0400
committerLance Stout <lancestout@gmail.com>2010-07-19 19:19:33 -0400
commitb5a14a0190f6ea45bfbc0e18a7ff6c61b6415865 (patch)
tree71eefc54a8c1d9586b1e4fb61ebb4b9d46bc2015 /sleekxmpp/basexmpp.py
parentfec8578cf61696d8ca85a6fe85a55be71d7109fd (diff)
downloadslixmpp-b5a14a0190f6ea45bfbc0e18a7ff6c61b6415865.tar.gz
slixmpp-b5a14a0190f6ea45bfbc0e18a7ff6c61b6415865.tar.bz2
slixmpp-b5a14a0190f6ea45bfbc0e18a7ff6c61b6415865.tar.xz
slixmpp-b5a14a0190f6ea45bfbc0e18a7ff6c61b6415865.zip
Can now pass a name to add_handler so that the handler can be reliably removed later.
Updated uses of add_handler to include a name.
Diffstat (limited to 'sleekxmpp/basexmpp.py')
-rw-r--r--sleekxmpp/basexmpp.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/sleekxmpp/basexmpp.py b/sleekxmpp/basexmpp.py
index 12dc2a1b..8489b24b 100644
--- a/sleekxmpp/basexmpp.py
+++ b/sleekxmpp/basexmpp.py
@@ -118,9 +118,11 @@ class basexmpp(object):
self.id += 1
return self.getId()
- def add_handler(self, mask, pointer, disposable=False, threaded=False, filter=False, instream=False):
- #logging.warning("Deprecated add_handler used for %s: %s." % (mask, pointer))
- self.registerHandler(XMLCallback('add_handler_%s' % self.getNewId(), MatchXMLMask(mask), pointer, threaded, disposable, instream))
+ def add_handler(self, mask, pointer, name=None, disposable=False, threaded=False, filter=False, instream=False):
+ # threaded is no longer needed, but leaving it for backwards compatibility for now
+ if name is None:
+ name = 'add_handler_%s' % self.getNewId()
+ self.registerHandler(XMLCallback(name, MatchXMLMask(mask), pointer, threaded, disposable, instream))
def getId(self):
return "%x".upper() % self.id