aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-04-29 02:40:14 +0200
committerKim Alvefur <zash@zash.se>2019-04-29 02:40:14 +0200
commit7e8621d4b5918ef20d00ba87f79fb895d3dff448 (patch)
treeddf089d432995ddd66e9427eb0ea772fde04f602
parentfe0ba7ac7ce6f9696d4b94c07676a279920758f8 (diff)
downloadprosody-7e8621d4b5918ef20d00ba87f79fb895d3dff448.tar.gz
prosody-7e8621d4b5918ef20d00ba87f79fb895d3dff448.zip
mod_mimicking: Update command to work with current code
-rw-r--r--plugins/mod_mimicking.lua23
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