aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-05-05 16:26:01 +0200
committerKim Alvefur <zash@zash.se>2019-05-05 16:26:01 +0200
commit696da1f571e723216a1e6b74d793eed4fe98dbd8 (patch)
tree65fec0bca3f59d8b78c60b263118ae65d839c95c /plugins
parent017e7f74389c0e20a1baaae682fd85b825975592 (diff)
downloadprosody-696da1f571e723216a1e6b74d793eed4fe98dbd8.tar.gz
prosody-696da1f571e723216a1e6b74d793eed4fe98dbd8.zip
mod_storage_sql: Add support for iterating over users in archive stores
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_storage_sql.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua
index ffe48ab8..596687ae 100644
--- a/plugins/mod_storage_sql.lua
+++ b/plugins/mod_storage_sql.lua
@@ -509,6 +509,19 @@ function archive_store:delete(username, query)
return ok and stmt:affected(), stmt;
end
+function archive_store:users()
+ local ok, result = engine:transaction(function()
+ local select_sql = [[
+ SELECT DISTINCT "user"
+ FROM "prosodyarchive"
+ WHERE "host"=? AND "store"=?;
+ ]];
+ return engine:select(select_sql, host, self.store);
+ end);
+ if not ok then error(result); end
+ return iterator(result);
+end
+
local stores = {
keyval = keyval_store;
map = map_store;