mod_storage_xmlarchive/mod_storage_xmlarchive.lua
changeset 2042 a85b5c3791dc
parent 1973 e63dba236a2a
child 2044 459e1878d23c
equal deleted inserted replaced
2041:632aa9f49aed 2042:a85b5c3791dc
    38 	local id = day .. "-" .. hmac_sha256(username.."@"..day.."+"..offset, data, true):sub(-16);
    38 	local id = day .. "-" .. hmac_sha256(username.."@"..day.."+"..offset, data, true):sub(-16);
    39 	ok, err = dm.list_append(username.."@"..day, module.host, self.store, { id = id, when = dt.datetime(when), with = with, offset = offset, length = #data });
    39 	ok, err = dm.list_append(username.."@"..day, module.host, self.store, { id = id, when = dt.datetime(when), with = with, offset = offset, length = #data });
    40 	if offset == 0 then
    40 	if offset == 0 then
    41 		-- means the message is at the beginnig of the file, so it's a new day
    41 		-- means the message is at the beginnig of the file, so it's a new day
    42 		-- so we add this new day to the "index"
    42 		-- so we add this new day to the "index"
    43 		dm.list_append(username, module.host, self.store, day);
    43 		ok, err = dm.list_append(username, module.host, self.store, day);
    44 	end
    44 	end
    45 	if not ok then
    45 	if not ok then
    46 		return nil, err;
    46 		return nil, err;
    47 	end
    47 	end
    48 	return id;
    48 	return id;