aboutsummaryrefslogtreecommitdiffstats
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
commit9b96017ca92a16719c614484e7c314bcd7b0ba80 (patch)
treea4bf52abcc4b451f0904b7962eb910aeed38a8c2
parenta32b5ceb4576f8fefeea0f68aae1f81dd942125d (diff)
downloadprosody-9b96017ca92a16719c614484e7c314bcd7b0ba80.tar.gz
prosody-9b96017ca92a16719c614484e7c314bcd7b0ba80.zip
mod_storage_memory: Implement archive summary API
-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