aboutsummaryrefslogtreecommitdiffstats
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
commit40040cdfbca7a934bb5e1256a9fdd403350eeaae (patch)
tree65fec0bca3f59d8b78c60b263118ae65d839c95c
parentef95de88710184351f130090685c5bc7ae7fbcaf (diff)
downloadprosody-40040cdfbca7a934bb5e1256a9fdd403350eeaae.tar.gz
prosody-40040cdfbca7a934bb5e1256a9fdd403350eeaae.zip
mod_storage_sql: Add support for iterating over users in archive stores
-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;