summaryrefslogtreecommitdiff
path: root/sleekxmpp/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'sleekxmpp/api.py')
-rw-r--r--sleekxmpp/api.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/sleekxmpp/api.py b/sleekxmpp/api.py
index 9d8ec201..82ff8ae7 100644
--- a/sleekxmpp/api.py
+++ b/sleekxmpp/api.py
@@ -14,9 +14,9 @@ class APIWrapper(object):
elif attr == 'settings':
return self.api.settings[self.name]
elif attr == 'register':
- def curried_handler(handler, op, jid=None, node=None):
+ def curried_handler(handler, op, jid=None, node=None, default=False):
register = getattr(self.api, attr)
- return register(handler, self.name, op, jid, node)
+ return register(handler, self.name, op, jid, node, default)
return curried_handler
elif attr == 'register_default':
def curried_handler(handler, op, jid=None, node=None):
@@ -153,6 +153,9 @@ class APIRegistry(object):
else:
self._handlers[ctype][op]['node'][(jid, node)] = handler
+ if default:
+ self.register_default(handler, ctype, op)
+
def register_default(self, handler, ctype, op):
"""Register a default, global handler for an operation.