diff options
author | Lance Stout <lancestout@gmail.com> | 2012-03-11 18:30:47 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-03-12 16:24:18 -0700 |
commit | 8b06d10415d6281f5836412129b7f04db6e16f04 (patch) | |
tree | 22227094708d459dd54fad40106062fe9be67371 /sleekxmpp/plugins/xep_0059/rsm.py | |
parent | 1a153487c3cb83550f6d80feb34c5c972f6ad6c2 (diff) | |
download | slixmpp-8b06d10415d6281f5836412129b7f04db6e16f04.tar.gz slixmpp-8b06d10415d6281f5836412129b7f04db6e16f04.tar.bz2 slixmpp-8b06d10415d6281f5836412129b7f04db6e16f04.tar.xz slixmpp-8b06d10415d6281f5836412129b7f04db6e16f04.zip |
Update XEP-0030 and XEP-0059 to new system.
Diffstat (limited to 'sleekxmpp/plugins/xep_0059/rsm.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0059/rsm.py | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/sleekxmpp/plugins/xep_0059/rsm.py b/sleekxmpp/plugins/xep_0059/rsm.py index 0e62bdde..a28bc7ee 100644 --- a/sleekxmpp/plugins/xep_0059/rsm.py +++ b/sleekxmpp/plugins/xep_0059/rsm.py @@ -10,9 +10,9 @@ import logging import sleekxmpp from sleekxmpp import Iq -from sleekxmpp.plugins.base import base_plugin +from sleekxmpp.plugins import BasePlugin, register_plugin from sleekxmpp.xmlstream import register_stanza_plugin -from sleekxmpp.plugins.xep_0059 import Set +from sleekxmpp.plugins.xep_0059 import stanza, Set from sleekxmpp.exceptions import XMPPError @@ -85,7 +85,7 @@ class ResultIterator(): num_items = len(r[self.interface]['substanzas']) if first + num_items == count: raise StopIteration - + if self.reverse: self.start = r[self.interface]['rsm']['first'] else: @@ -96,24 +96,24 @@ class ResultIterator(): raise StopIteration -class xep_0059(base_plugin): +class XEP_0059(BasePlugin): """ XEP-0050: Result Set Management """ + name = 'xep_0059' + description = 'XEP-0059: Result Set Management' + dependencies = set(['xep_0030']) + stanza = stanza + def plugin_init(self): """ Start the XEP-0059 plugin. """ - self.xep = '0059' - self.description = 'Result Set Management' - self.stanza = sleekxmpp.plugins.xep_0059.stanza - - def post_init(self): - """Handle inter-plugin dependencies.""" - base_plugin.post_init(self) self.xmpp['xep_0030'].add_feature(Set.namespace) + register_stanza_plugin(self.xmpp['xep_0030'].stanza.DiscoItems, + self.stanza.Set) def iterate(self, stanza, interface): """ @@ -129,3 +129,8 @@ class xep_0059(base_plugin): the interface 'disco_items' should be used. """ return ResultIterator(stanza, interface) + + +register_plugin(XEP_0059) + +xep_0059 = XEP_0059 |