aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_storage_memory.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-03-23 22:05:08 +0100
committerKim Alvefur <zash@zash.se>2019-03-23 22:05:08 +0100
commit4a2f05236136f1a2e1a74e120bb6131c628a278a (patch)
treea4bf52abcc4b451f0904b7962eb910aeed38a8c2 /plugins/mod_storage_memory.lua
parentaea959880cf8ae4d81c41d4e6ef224cc978ef278 (diff)
downloadprosody-4a2f05236136f1a2e1a74e120bb6131c628a278a.tar.gz
prosody-4a2f05236136f1a2e1a74e120bb6131c628a278a.zip
mod_storage_memory: Implement archive summary API
Diffstat (limited to 'plugins/mod_storage_memory.lua')
-rw-r--r--plugins/mod_storage_memory.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_storage_memory.lua b/plugins/mod_storage_memory.lua
index 8e1cf879..41180aba 100644
--- a/plugins/mod_storage_memory.lua
+++ b/plugins/mod_storage_memory.lua
@@ -147,6 +147,16 @@ function archive_store:find(username, query)
end, count;
end
+function archive:summary(username, query)
+ local iter, err = self:find(username, query)
+ if not iter then return iter, err; end
+ local summary = {};
+ for _, _, _, with in iter do
+ summary[with] = (summary[with] or 0) + 1;
+ end
+ return summary;
+end
+
function archive_store:delete(username, query)
if not query or next(query) == nil then