aboutsummaryrefslogtreecommitdiffstats
path: root/prosodyctl
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
commit572e00f29c746a9d386a719c1a76314dcb1e9e5d (patch)
tree99fde1223c54a30005ae4aaddf618ca4f02586eb /prosodyctl
parent41fa3bf420c882fbd7791ac9f61629a8997f505a (diff)
downloadprosody-572e00f29c746a9d386a719c1a76314dcb1e9e5d.tar.gz
prosody-572e00f29c746a9d386a719c1a76314dcb1e9e5d.zip
prosodyctl: Use jid.split() to parse parameter to adduser/deluser/passwd
Diffstat (limited to 'prosodyctl')
-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]]