aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-01-12 18:06:33 +0100
committerKim Alvefur <zash@zash.se>2021-01-12 18:06:33 +0100
commit494239414f3f7085eed5a9fdf5af77c5ee2dffa9 (patch)
tree337d151b18a0515564fa8dabc7102e61cadc3739
parentd5fb7e25107b80aaf000c025b148f0281e748062 (diff)
downloadprosody-494239414f3f7085eed5a9fdf5af77c5ee2dffa9.tar.gz
prosody-494239414f3f7085eed5a9fdf5af77c5ee2dffa9.zip
mod_storage_memory: Support query for set of IDs
-rw-r--r--plugins/mod_storage_memory.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/plugins/mod_storage_memory.lua b/plugins/mod_storage_memory.lua
index 1c960ead..9b0024ab 100644
--- a/plugins/mod_storage_memory.lua
+++ b/plugins/mod_storage_memory.lua
@@ -4,6 +4,7 @@ local envload = require "util.envload".envload;
local st = require "util.stanza";
local is_stanza = st.is_stanza or function (s) return getmetatable(s) == st.stanza_mt end
local new_id = require "util.id".medium;
+local set = require "util.set";
local auto_purge_enabled = module:get_option_boolean("storage_memory_temporary", false);
local auto_purge_stores = module:get_option_set("storage_memory_temporary_stores", {});
@@ -58,6 +59,7 @@ archive_store.caps = {
quota = archive_item_limit;
truncate = true;
full_id_range = true;
+ ids = true;
};
function archive_store:append(username, key, value, when, with)
@@ -110,6 +112,12 @@ function archive_store: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;