summaryrefslogtreecommitdiff
path: root/sleekxmpp/plugins/xep_0059/rsm.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2012-07-09 09:25:09 -0700
committerLance Stout <lancestout@gmail.com>2012-07-09 09:25:09 -0700
commitfbad22a1cdcaeb18847c042c089e0ec80d4d641e (patch)
tree1cbbb30251db7889fe7db9d469db26e2a8e2e33a /sleekxmpp/plugins/xep_0059/rsm.py
parent4a4a03858e87df15b0722e1c8951d5b8592a346a (diff)
parent5af2f62c049825a5f606b7041fa7e6f918d8486c (diff)
downloadslixmpp-fbad22a1cdcaeb18847c042c089e0ec80d4d641e.tar.gz
slixmpp-fbad22a1cdcaeb18847c042c089e0ec80d4d641e.tar.bz2
slixmpp-fbad22a1cdcaeb18847c042c089e0ec80d4d641e.tar.xz
slixmpp-fbad22a1cdcaeb18847c042c089e0ec80d4d641e.zip
Merge pull request #181 from whooo/upstream
Fix for the RSM iterator
Diffstat (limited to 'sleekxmpp/plugins/xep_0059/rsm.py')
-rw-r--r--sleekxmpp/plugins/xep_0059/rsm.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/sleekxmpp/plugins/xep_0059/rsm.py b/sleekxmpp/plugins/xep_0059/rsm.py
index 9335ed22..d4218202 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']