Software /
code /
prosody
Changeset
9984:bbabd35b30ae
mod_mimicking: Update command to work with current code
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 29 Apr 2019 02:40:14 +0200 |
parents | 9983:f7d11503fdce |
children | 9985:46c038969eb3 |
files | plugins/mod_mimicking.lua |
diffstat | 1 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_mimicking.lua Mon Apr 29 02:38:55 2019 +0200 +++ b/plugins/mod_mimicking.lua Mon Apr 29 02:40:14 2019 +0200 @@ -11,10 +11,15 @@ local skeleton = encodings.confusable.skeleton; local usage = require "util.prosodyctl".show_usage; -local warn = require "util.prosodyctl".show_warning; -local users = require "usermanager".users; +local usermanager = require "core.usermanager"; +local storagemanager = require "core.storagemanager"; -local skeletons = module:open_store("skeletons"); +local skeletons +function module.load() + if module.host ~= "*" then + skeletons = module:open_store("skeletons"); + end +end module:hook("user-registered", function(user) skeletons:set(skeleton(user.username), { username = user.username }); @@ -42,13 +47,13 @@ if not host_session then return "No such host"; end - local provider = host_session.users; - if not(provider) or provider.name == "null" then - usermanager.initialize_host(host); - end + storagemanager.initialize_host(host); + usermanager.initialize_host(host); - for user in users(host) do - datamanager.store(skeleton(user), host, "skeletons", {username = user}); + skeletons = storagemanager.open(host, "skeletons"); + + for user in usermanager.users(host) do + skeletons:set(skeleton(user), { username = user }); end end