Changeset

3294:89dd67cc3689

util.prosodyctl: Initialize the host's auth provider if necessary (thanks johnny, and all the other people whom this hindered :) )
author Matthew Wild <mwild1@gmail.com>
date Tue, 29 Jun 2010 19:18:07 +0100
parents 3293:4ce9d569a99c
children 3301:772fb30b28fb
files util/prosodyctl.lua
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/prosodyctl.lua	Tue Jun 29 19:11:18 2010 +0100
+++ b/util/prosodyctl.lua	Tue Jun 29 19:18:07 2010 +0100
@@ -21,6 +21,8 @@
 
 local CFG_SOURCEDIR = _G.CFG_SOURCEDIR;
 
+local prosody = prosody;
+
 module "prosodyctl"
 
 function adduser(params)
@@ -30,6 +32,11 @@
 	elseif not host then
 		return false, "invalid-hostname";
 	end
+
+	local provider = prosody.hosts[host].users;
+	if not(provider) or provider.name == "null" then
+		usermanager.initialize_host(host);
+	end
 	
 	local ok = usermanager.create_user(user, password, host);
 	if not ok then
@@ -39,6 +46,11 @@
 end
 
 function user_exists(params)
+	local provider = prosody.hosts[host].users;
+	if not(provider) or provider.name == "null" then
+		usermanager.initialize_host(host);
+	end
+	
 	return usermanager.user_exists(params.user, params.host);
 end