# HG changeset patch # User Kim Alvefur # Date 1701035041 -3600 # Node ID b6518a71ca7e16f3f34e6723bd53c15cc36505f2 # Parent e8938a3166d2df02a2340f829253d03d2706e8e9 mod_storage_s3: Implement search for set of IDs This together with the full id range query enables support for urn:xmpp:mam:2#extended in mod_mam diff -r e8938a3166d2 -r b6518a71ca7e mod_storage_s3/mod_storage_s3.lua --- a/mod_storage_s3/mod_storage_s3.lua Sun Nov 26 22:29:21 2023 +0100 +++ b/mod_storage_s3/mod_storage_s3.lua Sun Nov 26 22:44:01 2023 +0100 @@ -8,6 +8,7 @@ local jid = require "prosody.util.jid"; local json = require "prosody.util.json"; local promise = require "prosody.util.promise"; +local set = require "prosody.util.set"; local st = require "prosody.util.stanza"; local uuid = require "prosody.util.uuid"; local xml = require "prosody.util.xml"; @@ -199,6 +200,7 @@ archive.caps = { full_id_range = true; -- both before and after used + ids = true; }; function archive:_path(username, date, when, with, key) @@ -266,6 +268,7 @@ query["before"], query["after"] = query["after"], query["before"]; iterwrap = it.reverse; end + local ids = query["ids"] and set.new(query["ids"]); local found = not query["after"]; for content in iterwrap(list_bucket_result:childtags("Contents")) do local key = url.parse_path(content:get_child_text("Key")); @@ -275,6 +278,7 @@ if (not query["with"] or query["with"] == jid.unescape(key[5])) and (not query["start"] or dt.date(query["start"]) >= key[6]) and (not query["end"] or dt.date(query["end"]) <= key[6]) + and (not ids or ids:contains(key[6])) and found then keys:push({ key = key[6]; date = key[5]; with = jid.unescape(key[4]) }); end