From 80b9cd43b12f4221fdb69562e6114f0d3d07acbb Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Tue, 24 Oct 2017 10:54:53 +0100 Subject: MAM example: Also display the timestamp. --- examples/mam.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/mam.py b/examples/mam.py index 442d4516..5f9dde3a 100755 --- a/examples/mam.py +++ b/examples/mam.py @@ -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() -- cgit v1.2.3