summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0059/rsm.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-07-16 20:13:35 -0700
committerLance Stout <lancestout@gmail.com>2012-07-16 20:13:35 -0700
commit78f03253983779673beaf3c102ae315707a49d2c (patch)
treedd5c031b2fc96c88e3d03b7f21cb275ef937398c /sleekxmpp/plugins/xep_0059/rsm.py
parent1efe04995941933e7579efffd8f325d8c4b516ef (diff)
parentf6edaa56a6e91f7104cd63e5d48b39d4ca7e09f2 (diff)
downloadslixmpp-78f03253983779673beaf3c102ae315707a49d2c.tar.gz
slixmpp-78f03253983779673beaf3c102ae315707a49d2c.tar.bz2
slixmpp-78f03253983779673beaf3c102ae315707a49d2c.tar.xz
slixmpp-78f03253983779673beaf3c102ae315707a49d2c.zip
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0059/rsm.py')
-rw-r--r--sleekxmpp/plugins/xep_0059/rsm.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/sleekxmpp/plugins/xep_0059/rsm.py b/sleekxmpp/plugins/xep_0059/rsm.py
index 9335ed22..59cfc10b 100644
--- a/sleekxmpp/plugins/xep_0059/rsm.py
+++ b/sleekxmpp/plugins/xep_0059/rsm.py
@@ -47,6 +47,7 @@ class ResultIterator():
self.start = start
self.interface = interface
self.reverse = reverse
+ self._stop = False
def __iter__(self):
return self
@@ -62,6 +63,8 @@ class ResultIterator():
results will be the items before the current page
of items.
"""
+ if self._stop:
+ raise StopIteration
self.query[self.interface]['rsm']['before'] = self.reverse
self.query['id'] = self.query.stream.new_id()
self.query[self.interface]['rsm']['max'] = str(self.amount)
@@ -84,7 +87,7 @@ class ResultIterator():
first = int(r[self.interface]['rsm']['first_index'])
num_items = len(r[self.interface]['substanzas'])
if first + num_items == count:
- raise StopIteration
+ self._stop = True
if self.reverse:
self.start = r[self.interface]['rsm']['first']
@@ -111,10 +114,15 @@ class XEP_0059(BasePlugin):
"""
Start the XEP-0059 plugin.
"""
- self.xmpp['xep_0030'].add_feature(Set.namespace)
register_stanza_plugin(self.xmpp['xep_0030'].stanza.DiscoItems,
self.stanza.Set)
+ def plugin_end(self):
+ self.xmpp['xep_0030'].del_feature(feature=Set.namespace)
+
+ def session_bind(self, jid):
+ self.xmpp['xep_0030'].add_feature(Set.namespace)
+
def iterate(self, stanza, interface):
"""
Create a new result set iterator for a given stanza query.