Diff

plugins/mod_mimicking.lua @ 9983:f7d11503fdce

mod_mimicking: Use new storage API
author Kim Alvefur <zash@zash.se>
date Mon, 29 Apr 2019 02:38:55 +0200
parent 9982:d09575dae242
child 9984:bbabd35b30ae
line wrap: on
line diff
--- a/plugins/mod_mimicking.lua	Mon Apr 29 02:37:35 2019 +0200
+++ b/plugins/mod_mimicking.lua	Mon Apr 29 02:38:55 2019 +0200
@@ -10,21 +10,22 @@
 assert(encodings.confusable, "This module requires that Prosody be built with ICU");
 local skeleton = encodings.confusable.skeleton;
 
-local datamanager = require "util.datamanager";
 local usage = require "util.prosodyctl".show_usage;
 local warn = require "util.prosodyctl".show_warning;
 local users = require "usermanager".users;
 
+local skeletons = module:open_store("skeletons");
+
 module:hook("user-registered", function(user)
-	datamanager.store(skeleton(user.username), user.host, "skeletons", {username = user.username});
+	skeletons:set(skeleton(user.username), { username = user.username });
 end);
 
 module:hook("user-deleted", function(user)
-	datamanager.store(skeleton(user.username), user.host, "skeletons", nil);
+	skeletons:set(skeleton(user.username), nil);
 end);
 
 module:hook("user-registering", function(user)
-	if datamanager.load(skeleton(user.username), user.host, "skeletons") then
+	if skeletons:get(skeleton(user.username)) then
 		user.allowed = false;
 	end
 end);