Software /
code /
prosody-modules
Changeset
5765:645de410dbca
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.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 29 Nov 2023 11:14:21 +0100 |
parents | 5764:5232d12eb74d |
children | 5766:9944c6c3e914 |
files | mod_storage_xmlarchive/mod_storage_xmlarchive.lua |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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