diff options
author | Lance Stout <lancestout@gmail.com> | 2011-01-09 10:04:09 -0500 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2011-01-09 10:04:09 -0500 |
commit | 23e499998fc36b377e3adb77d3d59f885d94f21d (patch) | |
tree | 3dcef998633c65ea320cd2acfdaadb394e4ee773 /sleekxmpp/plugins/xep_0030 | |
parent | c156a4f723073e1e6394803b5bb1613227947266 (diff) | |
parent | acdf9e2d22dd604578f50d0a9b67c47e001da69f (diff) | |
download | slixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.tar.gz slixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.tar.bz2 slixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.tar.xz slixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.zip |
Merge branch 'develop' into roster
Diffstat (limited to 'sleekxmpp/plugins/xep_0030')
-rw-r--r-- | sleekxmpp/plugins/xep_0030/disco.py | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/sleekxmpp/plugins/xep_0030/disco.py b/sleekxmpp/plugins/xep_0030/disco.py index 4958c931..6fd4e85f 100644 --- a/sleekxmpp/plugins/xep_0030/disco.py +++ b/sleekxmpp/plugins/xep_0030/disco.py @@ -120,6 +120,12 @@ class xep_0030(base_plugin): 'jid': {}, 'node': {}} + def post_init(self): + """Handle cross-plugin dependencies.""" + base_plugin.post_init(self) + if self.xmpp['xep_0059']: + register_stanza_plugin(DiscoItems, self.xmpp['xep_0059'].stanza.Set) + def set_node_handler(self, htype, jid=None, node=None, handler=None): """ Add a node handler for the given hierarchy level and @@ -292,6 +298,9 @@ class xep_0030(base_plugin): callback -- Optional callback to execute when a reply is received instead of blocking and waiting for the reply. + iterator -- If True, return a result set iterator using + the XEP-0059 plugin, if the plugin is loaded. + Otherwise the parameter is ignored. """ if local or jid is None: return self._run_node_handler('get_items', jid, node, kwargs) @@ -302,9 +311,12 @@ class xep_0030(base_plugin): iq['to'] = jid iq['type'] = 'get' iq['disco_items']['node'] = node if node else '' - return iq.send(timeout=kwargs.get('timeout', None), - block=kwargs.get('block', None), - callback=kwargs.get('callback', None)) + if kwargs.get('iterator', False) and self.xmpp['xep_0059']: + return self.xmpp['xep_0059'].iterate(iq, 'disco_items') + else: + return iq.send(timeout=kwargs.get('timeout', None), + block=kwargs.get('block', None), + callback=kwargs.get('callback', None)) def set_items(self, jid=None, node=None, **kwargs): """ |