Mercurial > prosody-modules
diff mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 2420:309db11494c2
mod_storage_xmlarchive: Use util.stanza.is_stanza if available
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 19 Dec 2016 07:47:50 +0100 |
parents | 7bce126bf60c |
children | d47a7e6e9adc |
line wrap: on
line diff
--- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon Dec 19 07:43:28 2016 +0100 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Mon Dec 19 07:47:50 2016 +0100 @@ -20,11 +20,15 @@ local archive = {}; local archive_mt = { __index = archive }; +local is_stanza = st.is_stanza or function (s) + return getmetatable(s) == st.stanza_mt; +end + function archive:append(username, _, data, when, with) if type(when) ~= "number" then when, with, data = data, when, with; end - if getmetatable(data) ~= st.stanza_mt then + if not is_stanza(data) then module:log("error", "Attempt to store non-stanza object, traceback: %s", debug.traceback()); return nil, "unsupported-datatype"; end