MAM example: Also display the timestamp.

This commit is contained in:
Emmanuel Gil Peyrot 2017-10-24 10:54:53 +01:00
parent af1f9e08ad
commit 80b9cd43b1

View file

@ -43,8 +43,10 @@ class MAM(slixmpp.ClientXMPP):
async for rsm in results:
print('Page %d' % page)
for msg in rsm['mam']['results']:
forwarded_stanza = msg['mam_result']['forwarded']['stanza']
print('%s: %s' % (forwarded_stanza['from'], forwarded_stanza['body']))
forwarded = msg['mam_result']['forwarded']
timestamp = forwarded['delay']['stamp']
message = forwarded['stanza']
print('[%s] %s: %s' % (timestamp, message['from'], message['body']))
page += 1
self.disconnect()