# HG changeset patch # User Kim Alvefur # Date 1701252861 -3600 # Node ID 645de410dbca8cc7c6c0351099e8eb5a7a68981f # Parent 5232d12eb74dcee9e07007153445eb8acd989826 mod_storage_xmlarchive: Support using requested archive-id However diverging from the date-prefixed format means it will need to look through the whole archive to find a particular ID. diff -r 5232d12eb74d -r 645de410dbca mod_storage_xmlarchive/mod_storage_xmlarchive.lua --- a/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Tue Nov 28 19:55:43 2023 +0100 +++ b/mod_storage_xmlarchive/mod_storage_xmlarchive.lua Wed Nov 29 11:14:21 2023 +0100 @@ -34,7 +34,7 @@ return getmetatable(s) == st.stanza_mt; end -function archive:append(username, _, data, when, with) +function archive:append(username, id, data, when, with) if not is_stanza(data) then module:log("error", "Attempt to store non-stanza object, traceback: %s", debug.traceback()); return nil, "unsupported-datatype"; @@ -57,7 +57,7 @@ local offset = ok and err or 0; - local id = day .. "-" .. hmac_sha256(username.."@"..day.."+"..offset, data, true):sub(-16); + id = id or day .. "-" .. hmac_sha256(username.."@"..day.."+"..offset, data, true):sub(-16); ok, err = dm.list_append(username.."@"..day, self.host, self.store, { id = id, when = dt.datetime(when), with = with, offset = offset, length = #data }); if ok and first_of_day then