comparison mod_storage_xmlarchive/mod_storage_xmlarchive.lua @ 1739:940a4ab75cec

mod_storage_xmlarchive: This module only supports storage of stanzas, log a warning about attempts to do otherwise
author Kim Alvefur <zash@zash.se>
date Mon, 18 May 2015 02:43:34 +0200
parents b3f048af2dfe
children 11f7fb2f927f
comparison
equal deleted inserted replaced
1738:b3f048af2dfe 1739:940a4ab75cec
22 local archive = {}; 22 local archive = {};
23 local archive_mt = { __index = archive }; 23 local archive_mt = { __index = archive };
24 24
25 function archive:append(username, _, when, with, data) 25 function archive:append(username, _, when, with, data)
26 if getmetatable(data) ~= st.stanza_mt then 26 if getmetatable(data) ~= st.stanza_mt then
27 module:log("error", "Attempt to store non-stanza object, traceback: %s", debug.traceback());
27 return nil, "unsupported-datatype"; 28 return nil, "unsupported-datatype";
28 end 29 end
29 username = username or "@"; 30 username = username or "@";
30 data = tostring(data) .. "\n"; 31 data = tostring(data) .. "\n";
31 local day = dt.date(when); 32 local day = dt.date(when);