diff options
author | Kim Alvefur <zash@zash.se> | 2019-03-23 22:05:08 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-03-23 22:05:08 +0100 |
commit | 4a2f05236136f1a2e1a74e120bb6131c628a278a (patch) | |
tree | a4bf52abcc4b451f0904b7962eb910aeed38a8c2 | |
parent | aea959880cf8ae4d81c41d4e6ef224cc978ef278 (diff) | |
download | prosody-4a2f05236136f1a2e1a74e120bb6131c628a278a.tar.gz prosody-4a2f05236136f1a2e1a74e120bb6131c628a278a.zip |
mod_storage_memory: Implement archive summary API
-rw-r--r-- | plugins/mod_storage_memory.lua | 10 |
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 |