Software /
code /
prosody
Changeset
9905:6d50efaee148
mod_storage_memory: Implement archive summary API
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 23 Mar 2019 22:05:08 +0100 |
parents | 9904:bf061f5512f7 |
children | 9906:d0b58bdd6c86 |
files | plugins/mod_storage_memory.lua |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_memory.lua Mon Feb 25 15:51:55 2019 +0100 +++ b/plugins/mod_storage_memory.lua Sat Mar 23 22:05:08 2019 +0100 @@ -147,6 +147,16 @@ 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