diff options
author | Lance Stout <lancestout@gmail.com> | 2012-09-28 11:02:57 -0700 |
---|---|---|
committer | Lance Stout <lancestout@gmail.com> | 2012-09-28 11:02:57 -0700 |
commit | a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3 (patch) | |
tree | 40d99fd4b547e4f81e2c9c2b29682c6bb7ac7a06 /sleekxmpp/plugins/xep_0059/rsm.py | |
parent | 73ce9a5eccb5fea6f9a6dd72410cdada2a43347f (diff) | |
parent | ee9c4abd08db06fd6dc808d48c43cd6d57bd1aa1 (diff) | |
download | slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.gz slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.bz2 slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.tar.xz slixmpp-a2c60a4911c64a8b40c39dfb9d74ed0eaed0e9b3.zip |
Merge branch 'master' into develop
Diffstat (limited to 'sleekxmpp/plugins/xep_0059/rsm.py')
-rw-r--r-- | sleekxmpp/plugins/xep_0059/rsm.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sleekxmpp/plugins/xep_0059/rsm.py b/sleekxmpp/plugins/xep_0059/rsm.py index 59cfc10b..d73b45bc 100644 --- a/sleekxmpp/plugins/xep_0059/rsm.py +++ b/sleekxmpp/plugins/xep_0059/rsm.py @@ -25,11 +25,14 @@ class ResultIterator(): An iterator for Result Set Managment """ - def __init__(self, query, interface, amount=10, start=None, reverse=False): + def __init__(self, query, interface, results='substanzas', amount=10, + start=None, reverse=False): """ Arguments: query -- The template query interface -- The substanza of the query, for example disco_items + results -- The query stanza's interface which provides a + countable list of query results. amount -- The max amounts of items to request per iteration start -- From which item id to start reverse -- If True, page backwards through the results @@ -46,6 +49,7 @@ class ResultIterator(): self.amount = amount self.start = start self.interface = interface + self.results = results self.reverse = reverse self._stop = False @@ -85,7 +89,7 @@ class ResultIterator(): r[self.interface]['rsm']['first_index']: count = int(r[self.interface]['rsm']['count']) first = int(r[self.interface]['rsm']['first_index']) - num_items = len(r[self.interface]['substanzas']) + num_items = len(r[self.interface][self.results]) if first + num_items == count: self._stop = True @@ -123,7 +127,7 @@ class XEP_0059(BasePlugin): def session_bind(self, jid): self.xmpp['xep_0030'].add_feature(Set.namespace) - def iterate(self, stanza, interface): + def iterate(self, stanza, interface, results='substanzas'): """ Create a new result set iterator for a given stanza query. @@ -135,5 +139,7 @@ class XEP_0059(BasePlugin): result set management stanza should be appended. For example, for disco#items queries the interface 'disco_items' should be used. + results -- The name of the interface containing the + query results (typically just 'substanzas'). """ - return ResultIterator(stanza, interface) + return ResultIterator(stanza, interface, results) |