summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-10-24 10:54:53 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-10-24 10:54:53 +0100
commit80b9cd43b12f4221fdb69562e6114f0d3d07acbb (patch)
treeb1f35deaff80cd495aca30f27f245b7044c1b61d /examples
parentaf1f9e08ad195d1cab721c68d96278f9403e3dd8 (diff)
downloadslixmpp-80b9cd43b12f4221fdb69562e6114f0d3d07acbb.tar.gz
slixmpp-80b9cd43b12f4221fdb69562e6114f0d3d07acbb.tar.bz2
slixmpp-80b9cd43b12f4221fdb69562e6114f0d3d07acbb.tar.xz
slixmpp-80b9cd43b12f4221fdb69562e6114f0d3d07acbb.zip
MAM example: Also display the timestamp.
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/mam.py6
1 files changed, 4 insertions, 2 deletions
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()