summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0115/caps.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-03-30 23:02:48 -0700
committerLance Stout <lancestout@gmail.com>2012-04-06 15:09:25 -0400
commit488f7ed88691d9f7fa756a28702f6bee43d6a260 (patch)
tree62d59aef1051cd3ae0d068499e371efd5a6c6fdc /sleekxmpp/plugins/xep_0115/caps.py
parent51e5aee8308e42a89b7c0ab83ec53e2abea9767f (diff)
downloadslixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.tar.gz
slixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.tar.bz2
slixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.tar.xz
slixmpp-488f7ed88691d9f7fa756a28702f6bee43d6a260.zip
Begin experiment with a centralized API callback registry.
The API registry generalizes the node handler system from the xep_0030 plugin so that other plugins can use it.
Diffstat (limited to 'sleekxmpp/plugins/xep_0115/caps.py')
-rw-r--r--sleekxmpp/plugins/xep_0115/caps.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/sleekxmpp/plugins/xep_0115/caps.py b/sleekxmpp/plugins/xep_0115/caps.py
index 3aa0f70f..fee86f5b 100644
--- a/sleekxmpp/plugins/xep_0115/caps.py
+++ b/sleekxmpp/plugins/xep_0115/caps.py
@@ -78,7 +78,9 @@ class XEP_0115(BasePlugin):
self.static = StaticCaps(self.xmpp, disco.static)
for op in self._disco_ops:
- disco._add_disco_op(op, getattr(self.static, op))
+ self.api.register(getattr(self.static, op), 'xep_0115', op)
+ self.api.register_default(getattr(self.static, op),
+ 'xep_0115', op)
self._run_node_handler = disco._run_node_handler
@@ -279,19 +281,19 @@ class XEP_0115(BasePlugin):
jid = self.xmpp.boundjid.full
if isinstance(jid, JID):
jid = jid.full
- return self._run_node_handler('get_verstring', jid)
+ return self.api['get_verstring'](jid)
def assign_verstring(self, jid=None, verstring=None):
if jid in (None, ''):
jid = self.xmpp.boundjid.full
if isinstance(jid, JID):
jid = jid.full
- return self._run_node_handler('assign_verstring', jid,
- data={'verstring': verstring})
+ return self.api['assign_verstring'](jid, args={
+ 'verstring': verstring})
def cache_caps(self, verstring=None, info=None):
data = {'verstring': verstring, 'info': info}
- return self._run_node_handler('cache_caps', None, None, data=data)
+ return self.api['cache_caps'](args=data)
def get_caps(self, jid=None, verstring=None):
if verstring is None:
@@ -302,4 +304,4 @@ class XEP_0115(BasePlugin):
if isinstance(jid, JID):
jid = jid.full
data = {'verstring': verstring}
- return self._run_node_handler('get_caps', jid, None, None, data)
+ return self.api['get_caps'](jid, args=data)