mod_storage_muc_log/mod_storage_muc_log.lua
changeset 1757 54c8a0cb2996
parent 1569 711fabfe6604
child 1763 0aeab7234d5e
equal deleted inserted replaced
1756:3f3689a16133 1757:54c8a0cb2996
    46 local function st_with(tag)
    46 local function st_with(tag)
    47 	local with = tag.attr.type;
    47 	local with = tag.attr.type;
    48 	return with and tag.name .. "<" .. with or tag.name;
    48 	return with and tag.name .. "<" .. with or tag.name;
    49 end
    49 end
    50 
    50 
    51 function driver:append(node, key, when, with, stanza)
    51 function driver:append(node, key, stanza, when, with)
       
    52 	if type(when) ~= "number" then
       
    53 		value, when, with = when, with, value;
       
    54 	end
    52 	local today = os_date(datef, when);
    55 	local today = os_date(datef, when);
    53 	local now = os_date(timef, when);
    56 	local now = os_date(timef, when);
    54 	local data = data_load(node, host, datastore .. "/" .. today) or {};
    57 	local data = data_load(node, host, datastore .. "/" .. today) or {};
    55 	data[#data + 1] = "<stanza time=\"".. now .. "\">" .. tostring(stanza) .. "</stanza>\n";
    58 	data[#data + 1] = "<stanza time=\"".. now .. "\">" .. tostring(stanza) .. "</stanza>\n";
    56 	datamanager.getpath(node, host, datastore, nil, true); -- create the datastore dir
    59 	datamanager.getpath(node, host, datastore, nil, true); -- create the datastore dir