# HG changeset patch # User Kim Alvefur # Date 1482130070 -3600 # Node ID 309db11494c2741ac64f408b7cae9b941d2b2354 # Parent 045d594a37078c9313d61f1c139a57a20e16a534 mod_storage_xmlarchive: Use util.stanza.is_stanza if available diff -r 045d594a3707 -r 309db11494c2 mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- 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