Added amount parameter, so that limit on the msgs received per query can be changed.
This commit is contained in:
parent
db13794e0f
commit
11f707987d
2 changed files with 7 additions and 4 deletions
|
@ -142,7 +142,7 @@ class XEP_0059(BasePlugin):
|
||||||
def session_bind(self, jid):
|
def session_bind(self, jid):
|
||||||
self.xmpp['xep_0030'].add_feature(Set.namespace)
|
self.xmpp['xep_0030'].add_feature(Set.namespace)
|
||||||
|
|
||||||
def iterate(self, stanza, interface, results='substanzas',reverse=False,
|
def iterate(self, stanza, interface, results='substanzas', amount=10, reverse=False,
|
||||||
recv_interface=None, pre_cb=None, post_cb=None):
|
recv_interface=None, pre_cb=None, post_cb=None):
|
||||||
"""
|
"""
|
||||||
Create a new result set iterator for a given stanza query.
|
Create a new result set iterator for a given stanza query.
|
||||||
|
@ -170,6 +170,6 @@ class XEP_0059(BasePlugin):
|
||||||
results -- The name of the interface containing the
|
results -- The name of the interface containing the
|
||||||
query results (typically just 'substanzas').
|
query results (typically just 'substanzas').
|
||||||
"""
|
"""
|
||||||
return ResultIterator(stanza, interface, results, reverse=reverse,
|
return ResultIterator(stanza, interface, results, amount, reverse=reverse,
|
||||||
recv_interface=recv_interface, pre_cb=pre_cb,
|
recv_interface=recv_interface, pre_cb=pre_cb,
|
||||||
post_cb=post_cb)
|
post_cb=post_cb)
|
||||||
|
|
|
@ -53,9 +53,12 @@ class XEP_0313(BasePlugin):
|
||||||
iq['mam']['start'] = start
|
iq['mam']['start'] = start
|
||||||
iq['mam']['end'] = end
|
iq['mam']['end'] = end
|
||||||
iq['mam']['with'] = with_jid
|
iq['mam']['with'] = with_jid
|
||||||
|
amount = 10
|
||||||
if rsm:
|
if rsm:
|
||||||
for key, value in rsm.items():
|
for key, value in rsm.items():
|
||||||
iq['mam']['rsm'][key] = str(value)
|
iq['mam']['rsm'][key] = str(value)
|
||||||
|
if key is 'max':
|
||||||
|
amount = value
|
||||||
|
|
||||||
cb_data = {}
|
cb_data = {}
|
||||||
def pre_cb(query):
|
def pre_cb(query):
|
||||||
|
@ -72,8 +75,8 @@ class XEP_0313(BasePlugin):
|
||||||
result['mam']['results'] = results
|
result['mam']['results'] = results
|
||||||
|
|
||||||
if iterator:
|
if iterator:
|
||||||
return self.xmpp['xep_0059'].iterate(iq, 'mam', 'results', reverse=reverse,
|
return self.xmpp['xep_0059'].iterate(iq, 'mam', 'results', amount=amount,
|
||||||
recv_interface='mam_fin',
|
reverse=reverse, recv_interface='mam_fin',
|
||||||
pre_cb=pre_cb, post_cb=post_cb)
|
pre_cb=pre_cb, post_cb=post_cb)
|
||||||
|
|
||||||
collector = Collector(
|
collector = Collector(
|
||||||
|
|
Loading…
Reference in a new issue