# HG changeset patch # User Kim Alvefur # Date 1556498414 -7200 # Node ID bbabd35b30ae0970b21f3ede1f8e8713468962c1 # Parent f7d11503fdce9fe3e457104745cf3d50ea973611 mod_mimicking: Update command to work with current code diff -r f7d11503fdce -r bbabd35b30ae plugins/mod_mimicking.lua --- 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