From 488f7ed88691d9f7fa756a28702f6bee43d6a260 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Fri, 30 Mar 2012 23:02:48 -0700 Subject: 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. --- sleekxmpp/plugins/xep_0115/caps.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sleekxmpp/plugins/xep_0115') 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) -- cgit v1.2.3