aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-05-20 15:33:57 +0100
committerMatthew Wild <mwild1@gmail.com>2013-05-20 15:33:57 +0100
commit8c3cb3971b29f84e8831f5ded9863cc282bfcde5 (patch)
tree99fde1223c54a30005ae4aaddf618ca4f02586eb
parent582360b3b27b1f2ed4a11ec47d84e80600e1ed2f (diff)
downloadprosody-8c3cb3971b29f84e8831f5ded9863cc282bfcde5.tar.gz
prosody-8c3cb3971b29f84e8831f5ded9863cc282bfcde5.zip
prosodyctl: Use jid.split() to parse parameter to adduser/deluser/passwd
-rwxr-xr-xprosodyctl9
1 files changed, 6 insertions, 3 deletions
diff --git a/prosodyctl b/prosodyctl
index 41f3b8dc..780821be 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -274,11 +274,12 @@ local commands = {};
local command = arg[1];
function commands.adduser(arg)
+ local jid_split = require "util.jid".split;
if not arg[1] or arg[1] == "--help" then
show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);
return 1;
end
- local user, host = arg[1]:match("([^@]+)@(.+)");
+ local user, host = jid_split(arg[1]);
if not user and host then
show_message [[Failed to understand JID, please supply the JID you want to create]]
show_usage [[adduser user@host]]
@@ -313,11 +314,12 @@ function commands.adduser(arg)
end
function commands.passwd(arg)
+ local jid_split = require "util.jid".split;
if not arg[1] or arg[1] == "--help" then
show_usage([[passwd JID]], [[Set the password for the specified user account in Prosody]]);
return 1;
end
- local user, host = arg[1]:match("([^@]+)@(.+)");
+ local user, host = jid_split(arg[1]);
if not user and host then
show_message [[Failed to understand JID, please supply the JID you want to set the password for]]
show_usage [[passwd user@host]]
@@ -352,11 +354,12 @@ function commands.passwd(arg)
end
function commands.deluser(arg)
+ local jid_split = require "util.jid".split;
if not arg[1] or arg[1] == "--help" then
show_usage([[deluser JID]], [[Permanently remove the specified user account from Prosody]]);
return 1;
end
- local user, host = arg[1]:match("([^@]+)@(.+)");
+ local user, host = jid_split(arg[1]);
if not user and host then
show_message [[Failed to understand JID, please supply the JID you want to set the password for]]
show_usage [[passwd user@host]]