diff options
author | Kim Alvefur <zash@zash.se> | 2019-04-29 02:40:14 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2019-04-29 02:40:14 +0200 |
commit | 54d0329e4c0809920c954a45e448263d3a669a2b (patch) | |
tree | ddf089d432995ddd66e9427eb0ea772fde04f602 /plugins/mod_mimicking.lua | |
parent | 00887cf07d565353152332f0adb854659e237fbf (diff) | |
download | prosody-54d0329e4c0809920c954a45e448263d3a669a2b.tar.gz prosody-54d0329e4c0809920c954a45e448263d3a669a2b.zip |
mod_mimicking: Update command to work with current code
Diffstat (limited to 'plugins/mod_mimicking.lua')
-rw-r--r-- | plugins/mod_mimicking.lua | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/plugins/mod_mimicking.lua b/plugins/mod_mimicking.lua index 0da68059..a8d6803e 100644 --- a/plugins/mod_mimicking.lua +++ b/plugins/mod_mimicking.lua @@ -11,10 +11,15 @@ assert(encodings.confusable, "This module requires that Prosody be built with IC 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 @@ function module.command(arg) 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); + + skeletons = storagemanager.open(host, "skeletons"); - for user in users(host) do - datamanager.store(skeleton(user), host, "skeletons", {username = user}); + for user in usermanager.users(host) do + skeletons:set(skeleton(user), { username = user }); end end |