Software /
code /
prosody-modules
Changeset
1477:db870913e1cf
mod_mam_archive: Doing stanza deserialization after mod_storage the right way
author | syn@syn.im |
---|---|
date | Wed, 30 Jul 2014 21:58:56 +0200 |
parents | 1476:08ca6dd36e39 |
children | 1478:099583539e2c |
files | mod_mam_archive/mod_mam_archive.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_mam_archive/mod_mam_archive.lua Wed Jul 30 21:27:56 2014 +0200 +++ b/mod_mam_archive/mod_mam_archive.lua Wed Jul 30 21:58:56 2014 +0200 @@ -268,9 +268,14 @@ module:log("debug", "Count "..count); for id, item, when in data do - local tag = jid_bare(item["attr"]["from"]) == jid_bare(origin.full_jid) and "from" or "to"; + if not getmetatable(item) == st.stanza_mt then + item = st.deserialize(item); + end + module:log("debug", tostring(item)); + + local tag = jid_bare(item.attr["from"]) == jid_bare(origin.full_jid) and "from" or "to"; tag = chat:tag(tag, {secs = when - qstart}); - tag:tag("body"):text(item[2][1]):up():up(); + tag:add_child(item:get_child("body")):up(); end origin.send(reply);