Clean up the MAM example a bit.
This commit is contained in:
parent
e3fd0af9c8
commit
af1f9e08ad
1 changed files with 3 additions and 3 deletions
|
@ -38,13 +38,13 @@ class MAM(slixmpp.ClientXMPP):
|
||||||
Fetch mam results for the specified JID.
|
Fetch mam results for the specified JID.
|
||||||
Use RSM to paginate the results.
|
Use RSM to paginate the results.
|
||||||
"""
|
"""
|
||||||
iq = self.make_iq_get()
|
|
||||||
results = self.plugin['xep_0313'].retrieve(jid=self.remote_jid, iterator=True, rsm={'max': 10}, start=self.start_date)
|
results = self.plugin['xep_0313'].retrieve(jid=self.remote_jid, iterator=True, rsm={'max': 10}, start=self.start_date)
|
||||||
page = 1
|
page = 1
|
||||||
async for rsm in results:
|
async for rsm in results:
|
||||||
print('Page %s' % page)
|
print('Page %d' % page)
|
||||||
for msg in rsm['mam']['results']:
|
for msg in rsm['mam']['results']:
|
||||||
print('%s: %s' % (msg['mam_result']['forwarded']['stanza']['from'], msg['mam_result']['forwarded']['stanza']['body']))
|
forwarded_stanza = msg['mam_result']['forwarded']['stanza']
|
||||||
|
print('%s: %s' % (forwarded_stanza['from'], forwarded_stanza['body']))
|
||||||
page += 1
|
page += 1
|
||||||
self.disconnect()
|
self.disconnect()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue