aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-01-12 18:06:55 +0100
committerKim Alvefur <zash@zash.se>2021-01-12 18:06:55 +0100
commit344d8e7d51106de946ffbfa3f5a8bfc9aa2082af (patch)
tree3dabd2b8a33dbac9e1371e7205729182ff272599
parent494239414f3f7085eed5a9fdf5af77c5ee2dffa9 (diff)
downloadprosody-344d8e7d51106de946ffbfa3f5a8bfc9aa2082af.tar.gz
prosody-344d8e7d51106de946ffbfa3f5a8bfc9aa2082af.zip
mod_storage_internal: Support query for set of IDs
Based on implementation in mod_storage_memory
-rw-r--r--plugins/mod_storage_internal.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua
index 3b14fbaa..5d685ed9 100644
--- a/plugins/mod_storage_internal.lua
+++ b/plugins/mod_storage_internal.lua
@@ -6,6 +6,7 @@ local st = require "util.stanza";
local now = require "util.time".now;
local id = require "util.id".medium;
local jid_join = require "util.jid".join;
+local set = require "util.set";
local host = module.host;
@@ -53,6 +54,7 @@ archive.caps = {
quota = archive_item_limit;
truncate = true;
full_id_range = true;
+ ids = true;
};
function archive:append(username, key, value, when, with)
@@ -144,6 +146,12 @@ function archive:find(username, query)
return item.key == query.key;
end);
end
+ if query.ids then
+ local ids = set.new(query.ids);
+ items:filter(function (item)
+ return ids:contains(item.key);
+ end);
+ end
if query.with then
items:filter(function (item)
return item.with == query.with;