From e31667cf151d9d81cf2ab16eece72e559983fb52 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 10 Jan 2019 14:54:34 +0100 Subject: prosodyctl: Pass the original argv table to subcommands (with first argument removed) This preserves eg arg[-1] where you might find the path to the Lua executable, which can be useful. --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 76de45a2..ecf00baa 100755 --- a/prosodyctl +++ b/prosodyctl @@ -83,7 +83,7 @@ local jid_split = require "util.jid".prepped_split; local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; ----------------------- local commands = {}; -local command = arg[1]; +local command = table.remove(arg, 1); function commands.adduser(arg) if not arg[1] or arg[1] == "--help" then @@ -1365,7 +1365,7 @@ local command_runner = async.runner(function () os.exit(0); end - os.exit(commands[command]({ select(2, unpack(arg)) })); + os.exit(commands[command](arg)); end, watchers); command_runner:run(true); -- cgit v1.2.3 From 1e4a0ebba24834980440a61636601732b762e397 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 10 Jan 2019 15:25:38 +0100 Subject: prosodyctl: Use the same runtime for starting prosody Improves the experience with the `make integration-test` command --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index ecf00baa..0ff03a7b 100755 --- a/prosodyctl +++ b/prosodyctl @@ -222,7 +222,7 @@ function commands.start(arg) end --luacheck: ignore 411/ret - local ok, ret = prosodyctl.start(prosody.paths.source); + local ok, ret = prosodyctl.start(prosody.paths.source, arg[-1]); if ok then local daemonize = configmanager.get("*", "daemonize"); if daemonize == nil then -- cgit v1.2.3 From 467260e6f51942bc4a113bc0ca23808002289147 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 4 Oct 2018 12:23:06 +0200 Subject: mod_bosh: Drop CORS code in favor of than in mod_http This deprecates the cross_domain_bosh setting. As a compat measure, if it is set, mod_http_crossdomain is loaded. --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 0ff03a7b..4d91cfe5 100755 --- a/prosodyctl +++ b/prosodyctl @@ -806,7 +806,7 @@ function commands.check(arg) print("Checking config..."); local deprecated = set.new({ "bosh_ports", "disallow_s2s", "no_daemonize", "anonymous_login", "require_encryption", - "vcard_compatibility", + "vcard_compatibility", "cross_domain_bosh", }); local known_global_options = set.new({ "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize", -- cgit v1.2.3 From 7fefafa8f6cc312b41f69d8149d5a926657bc9fb Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 4 Oct 2018 12:24:08 +0200 Subject: mod_websocket: Drop CORS code in favor of that in mod_http Like for mod_bosh, deprecates consider_websocket_secure and depend on mod_http_crossdomain if it is set. --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 4d91cfe5..efb98386 100755 --- a/prosodyctl +++ b/prosodyctl @@ -806,7 +806,7 @@ function commands.check(arg) print("Checking config..."); local deprecated = set.new({ "bosh_ports", "disallow_s2s", "no_daemonize", "anonymous_login", "require_encryption", - "vcard_compatibility", "cross_domain_bosh", + "vcard_compatibility", "cross_domain_bosh", "cross_domain_websocket" }); local known_global_options = set.new({ "pidfile", "log", "plugin_paths", "prosody_user", "prosody_group", "daemonize", -- cgit v1.2.3 From d254f7e101f76154ad5fb1a22964b74cba93d675 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 18 Jan 2019 18:30:41 +0100 Subject: prosodyctl: Fix module.command invocation (thanks woffs) The first argument is already removed once since c7727c13260f --- prosodyctl | 2 -- 1 file changed, 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index efb98386..a628ed2b 100755 --- a/prosodyctl +++ b/prosodyctl @@ -1300,8 +1300,6 @@ local command_runner = async.runner(function () end end - table.remove(arg, 1); - local module = modulemanager.get_module("*", module_name); if not module then show_message("Failed to load module '"..module_name.."': Unknown error"); -- cgit v1.2.3 From 42f4b6b225edf608828ca0716934c41a690964db Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 8 Dec 2018 18:02:56 +0100 Subject: prosodyctl: about: Report the current operating system according to uname --- prosodyctl | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index a628ed2b..f6812e23 100755 --- a/prosodyctl +++ b/prosodyctl @@ -363,6 +363,13 @@ function commands.about(arg) .."\n "; end))); print(""); + local have_pposix, pposix = pcall(require, "util.pposix"); + if have_pposix and pposix.uname then + print("# Operating system"); + local uname, err = pposix.uname(); + print(uname and uname.sysname .. " " .. uname.release or "Unknown POSIX", err or ""); + print(""); + end print("# Lua environment"); print("Lua version: ", _G._VERSION); print(""); -- cgit v1.2.3 From de37e6cb589e0124b93a38721c8ad809ba762b16 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 29 Jun 2019 16:54:39 +0200 Subject: prosodyctl: Fix extraction of interpreter from arg when additional arguments (fixes #1386) Interpreter goes into the lowest negative index. See http://www.lua.org/manual/5.2/manual.html#7 --- prosodyctl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index f5786ff9..3809beff 100755 --- a/prosodyctl +++ b/prosodyctl @@ -222,7 +222,15 @@ function commands.start(arg) end --luacheck: ignore 411/ret - local ok, ret = prosodyctl.start(prosody.paths.source, arg[-1]); + local lua; + do + local i = 0; + repeat + i = i - 1; + until arg[i-1] == nil + lua = arg[i]; + end + local ok, ret = prosodyctl.start(prosody.paths.source, lua); if ok then local daemonize = configmanager.get("*", "daemonize"); if daemonize == nil then -- cgit v1.2.3 From 66bb4ab4494853abfad5a53854355f03d4b7ae6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 7 Jun 2019 11:36:13 +0100 Subject: prosodyctl: Created a custom function, 'test', that prints back a welcoming message --- prosodyctl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index f5786ff9..db7b0dc4 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,6 +85,10 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); +function commands.test() + show_message [[Well, hello there!]] +end + function commands.adduser(arg) if not arg[1] or arg[1] == "--help" then show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); -- cgit v1.2.3 From 83ca8aef547856ab0caead6f9f999f642818de95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 7 Jun 2019 11:46:19 +0100 Subject: prosodyctl: The 'test' function now also prints which plugins are enabled --- prosodyctl | 2 ++ 1 file changed, 2 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index db7b0dc4..4036c59a 100755 --- a/prosodyctl +++ b/prosodyctl @@ -87,6 +87,8 @@ local command = table.remove(arg, 1); function commands.test() show_message [[Well, hello there!]] + --show_message [[Enabled Plugins: ], modulemanager.get_modules_for_host()] + show_warning("Trying to peek at the plugin directory: '%s'", modulemanager.get_modules_for_host()) end function commands.adduser(arg) -- cgit v1.2.3 From cf25afe5b143eea8b1ca7d74462965d6e8184b2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 7 Jun 2019 13:00:40 +0100 Subject: prosodyctl: Added the 'local_plugins' command function, which prints back a list of locally available plugins --- prosodyctl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 4036c59a..00d24b1c 100755 --- a/prosodyctl +++ b/prosodyctl @@ -87,10 +87,25 @@ local command = table.remove(arg, 1); function commands.test() show_message [[Well, hello there!]] - --show_message [[Enabled Plugins: ], modulemanager.get_modules_for_host()] show_warning("Trying to peek at the plugin directory: '%s'", modulemanager.get_modules_for_host()) end +function commands.local_plugins() + local directory = "./plugins" + local i, t, popen = 0, {}, io.popen + local pfile = popen('ls -a "'..directory..'"') + for filename in pfile:lines() do + if filename == "." or filename == ".." then + i = i + 1 + else + i = i + 1 + t[i] = filename + show_warning("%s", t[i]) + end + end + pfile:close() +end + function commands.adduser(arg) if not arg[1] or arg[1] == "--help" then show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); -- cgit v1.2.3 From 8025f98427a23a64f3dd303aedde6fcc8d5ea688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 7 Jun 2019 13:09:01 +0100 Subject: prosodyctl: Renamed the command function 'test' to 'enabled_plugins', which now only shows the plugins, in a list --- prosodyctl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 00d24b1c..a7300973 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,9 +85,10 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); -function commands.test() - show_message [[Well, hello there!]] - show_warning("Trying to peek at the plugin directory: '%s'", modulemanager.get_modules_for_host()) +function commands.enabled_plugins() + for module in modulemanager.get_modules_for_host() do + show_warning("%s", module) + end end function commands.local_plugins() -- cgit v1.2.3 From 992d18aa62af23bbb5849e728a9b298b556e2cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Thu, 20 Jun 2019 19:17:47 +0100 Subject: prosodyctl: Implemented the 'list' command, which is a bridge to 'luarocks list' --- prosodyctl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index a7300973..d726c028 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,6 +85,19 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); +function commands.list(arg) + -- Need to think about the case with many flags + local flag="--tree=" + -- I'm considering the flag is the first, but there can be many flags + if arg[1] and arg[1]:sub(1, #flag) == flag then + local dir = arg[1]:match("=(.+)$") + -- These extra double brackets allow us to correctly process names with spaces + os.execute("luarocks list --tree=".."'"..dir.."'") + else + os.execute("luarocks list --tree="..prosody.paths.data.."/rocks") + end +end + function commands.enabled_plugins() for module in modulemanager.get_modules_for_host() do show_warning("%s", module) -- cgit v1.2.3 From 1fda45e5860bbfd748ec163b4f7ebe03d1ba7c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 21 Jun 2019 19:03:04 +0100 Subject: prosodyctl: Implemented a command bridge to the 'luarocks-admin add' command, called 'admin_add' --- prosodyctl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index d726c028..efe6394e 100755 --- a/prosodyctl +++ b/prosodyctl @@ -87,7 +87,7 @@ local command = table.remove(arg, 1); function commands.list(arg) -- Need to think about the case with many flags - local flag="--tree=" + local flag = "--tree=" -- I'm considering the flag is the first, but there can be many flags if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") @@ -98,6 +98,22 @@ function commands.list(arg) end end +function commands.admin_add(arg) + local modules, tree, server, refresh = "", "", "", "" + for i, _ in ipairs(arg) do + if arg[i]:sub(1, #"--tree=") == "--tree=" then + tree = arg[i].." " + elseif arg[i]:sub(1, #"--server=") == "--server=" then + server = arg[i].." " + elseif arg[i]:sub(1, #"--no-refresh") == "--no-refresh" then + refresh = arg[i].." " + else + modules=modules..arg[i].." " + end + end + os.execute("luarocks-admin "..tree.."add "..server..refresh..modules) +end + function commands.enabled_plugins() for module in modulemanager.get_modules_for_host() do show_warning("%s", module) -- cgit v1.2.3 From b12ba155400cc80ff269a100e18bcbdd53f86041 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 25 Jun 2019 00:52:12 +0100 Subject: prosodyctl: Changed the command 'admin_add' to 'admin_operation', which will be called by both add/remove operations --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index efe6394e..56fa3f24 100755 --- a/prosodyctl +++ b/prosodyctl @@ -98,7 +98,7 @@ function commands.list(arg) end end -function commands.admin_add(arg) +function admin_operation(operation, arg) local modules, tree, server, refresh = "", "", "", "" for i, _ in ipairs(arg) do if arg[i]:sub(1, #"--tree=") == "--tree=" then @@ -111,7 +111,7 @@ function commands.admin_add(arg) modules=modules..arg[i].." " end end - os.execute("luarocks-admin "..tree.."add "..server..refresh..modules) + os.execute("luarocks-admin "..tree..operation..server..refresh..modules) end function commands.enabled_plugins() -- cgit v1.2.3 From 6021b5871292b692043b80334ecbe1133965519d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 25 Jun 2019 12:02:37 +0100 Subject: prosodyctl: Added the 'admin_add' command --- prosodyctl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 56fa3f24..1180d039 100755 --- a/prosodyctl +++ b/prosodyctl @@ -114,6 +114,10 @@ function admin_operation(operation, arg) os.execute("luarocks-admin "..tree..operation..server..refresh..modules) end +function commands.admin_add(arg) + admin_operation("add ", arg) +end + function commands.enabled_plugins() for module in modulemanager.get_modules_for_host() do show_warning("%s", module) -- cgit v1.2.3 From 2aa2aff974345346344416ca1f91f0c5190dd93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 25 Jun 2019 12:03:20 +0100 Subject: prosodyctl: Added the 'admin_remove' command --- prosodyctl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 1180d039..75b36e34 100755 --- a/prosodyctl +++ b/prosodyctl @@ -118,6 +118,10 @@ function commands.admin_add(arg) admin_operation("add ", arg) end +function commands.admin_remove(arg) + admin_operation("remove ", arg) +end + function commands.enabled_plugins() for module in modulemanager.get_modules_for_host() do show_warning("%s", module) -- cgit v1.2.3 From 122bde2f2c4816e89bd02be36e0e9f1ee31f7557 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 25 Jun 2019 13:20:54 +0100 Subject: util.prosodyctl: Moved the 'admin_operation' function from prosodyctl to here --- prosodyctl | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 75b36e34..05f711d7 100755 --- a/prosodyctl +++ b/prosodyctl @@ -98,22 +98,6 @@ function commands.list(arg) end end -function admin_operation(operation, arg) - local modules, tree, server, refresh = "", "", "", "" - for i, _ in ipairs(arg) do - if arg[i]:sub(1, #"--tree=") == "--tree=" then - tree = arg[i].." " - elseif arg[i]:sub(1, #"--server=") == "--server=" then - server = arg[i].." " - elseif arg[i]:sub(1, #"--no-refresh") == "--no-refresh" then - refresh = arg[i].." " - else - modules=modules..arg[i].." " - end - end - os.execute("luarocks-admin "..tree..operation..server..refresh..modules) -end - function commands.admin_add(arg) admin_operation("add ", arg) end -- cgit v1.2.3 From 79191ed8f28bc8a26b782f3ef3e28459029c9f76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 25 Jun 2019 13:22:22 +0100 Subject: prosodyctl: Corrected the calls to the recently moved function 'admin_operation' --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 05f711d7..2c786b95 100755 --- a/prosodyctl +++ b/prosodyctl @@ -99,11 +99,11 @@ function commands.list(arg) end function commands.admin_add(arg) - admin_operation("add ", arg) + prosodyctl.admin_operation("add ", arg) end function commands.admin_remove(arg) - admin_operation("remove ", arg) + prosodyctl.admin_operation("remove ", arg) end function commands.enabled_plugins() -- cgit v1.2.3 From fce54a8010c647e28274b54e169f92c814855649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 26 Jun 2019 16:46:51 +0100 Subject: prosodyctl: Complemented my functions with return calls, when possible --- prosodyctl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 2c786b95..8cf90048 100755 --- a/prosodyctl +++ b/prosodyctl @@ -10,7 +10,6 @@ -- prosodyctl - command-line controller for Prosody XMPP server -- Will be modified by configure script if run -- - CFG_SOURCEDIR=CFG_SOURCEDIR or os.getenv("PROSODY_SRCDIR"); CFG_CONFIGDIR=CFG_CONFIGDIR or os.getenv("PROSODY_CFGDIR"); CFG_PLUGINDIR=CFG_PLUGINDIR or os.getenv("PROSODY_PLUGINDIR"); @@ -93,17 +92,21 @@ function commands.list(arg) local dir = arg[1]:match("=(.+)$") -- These extra double brackets allow us to correctly process names with spaces os.execute("luarocks list --tree=".."'"..dir.."'") + return 0; else os.execute("luarocks list --tree="..prosody.paths.data.."/rocks") + return 0; end end function commands.admin_add(arg) prosodyctl.admin_operation("add ", arg) + return 0; end function commands.admin_remove(arg) prosodyctl.admin_operation("remove ", arg) + return 0; end function commands.enabled_plugins() @@ -126,6 +129,7 @@ function commands.local_plugins() end end pfile:close() + return 0 end function commands.adduser(arg) -- cgit v1.2.3 From 11a354176f389c17770db9a11f45cd3cdcfe7472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Thu, 27 Jun 2019 18:00:11 +0100 Subject: prosodyctl: added help support to all my functions --- prosodyctl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 8cf90048..7cae908e 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,6 +85,10 @@ local commands = {}; local command = table.remove(arg, 1); function commands.list(arg) + if not arg[1] or arg[1] == "--help" then + show_usage([[list]], [[Shows installed rocks]]); + return 1; + end -- Need to think about the case with many flags local flag = "--tree=" -- I'm considering the flag is the first, but there can be many flags @@ -109,13 +113,21 @@ function commands.admin_remove(arg) return 0; end -function commands.enabled_plugins() +function commands.enabled_plugins(arg) + if arg[1] == "--help" then + show_usage([[enabled_plugins]], [[Shows plugins currently enabled on prosody]]); + return 1; + end for module in modulemanager.get_modules_for_host() do show_warning("%s", module) end end -function commands.local_plugins() +function commands.local_plugins(arg) + if arg[1] == "--help" then + show_usage([[local_plugins]], [[Shows plugins currently available for prosody, locally]]); + return 1; + end local directory = "./plugins" local i, t, popen = 0, {}, io.popen local pfile = popen('ls -a "'..directory..'"') @@ -1397,7 +1409,8 @@ local command_runner = async.runner(function () print("Where COMMAND may be one of:\n"); local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; - local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", "about" }; + local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", "about", "local_plugins", "enabled_plugins", + "admin_add", "admin_remove", "list", }; local done = {}; -- cgit v1.2.3 From 7c291a6e154b0325ca4173995810f7b0831f7480 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 16 Jul 2019 10:05:31 -0700 Subject: prosodyctl: Added the 'get_modules' commands --- prosodyctl | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 7cae908e..0bde4478 100755 --- a/prosodyctl +++ b/prosodyctl @@ -84,6 +84,35 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); +-- This function receives no arguments. It clones all the plugins from prosody's plugin repository +function commands.get_modules(arg) + if arg[1] == "--help" then + show_usage([[get_modules]], [[Downloads all available modules]]); + return 1 + end + if os.execute '[ -e "./downloaded_modules" ]' then + print("The modules have already been imported") + print("Do you want to re-import?(Y/N)") + local answer = io.read() + if answer == "Y" then + print("Deleting previous imports") + os.execute("rm -rf downloaded_modules") + print("Downloading plugins") + os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") + print("Done!") + return 0 + else + print("We keep what we have then!") + return 0 + end + else + print("Getting all the available modules") + os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") + print("Done!") + return 0 + end +end + function commands.list(arg) if not arg[1] or arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]); -- cgit v1.2.3 From db90fc5da5288330ba1780d387ab7bdafc3210ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 16 Jul 2019 10:08:12 -0700 Subject: prosodyctl: Added the 'write_rockspec' function --- prosodyctl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 0bde4478..baea969a 100755 --- a/prosodyctl +++ b/prosodyctl @@ -113,6 +113,22 @@ function commands.get_modules(arg) end end +-- Function to write rockspecs from a module at working_directory/downloaded_modules +-- Receives the module's name as an argument +-- The rockspec is saved inside its module's folder +function commands.write_rockspec(arg) + if arg[1] == "--help" then + show_usage([[write_rockspec]], [[Picks up a module and writes an initial rockspec]]); + return 1 + end + print("Writing rockspec for "..arg[1]) + os.execute("luarocks write_rockspec "..arg[1].." ./downloaded_modules/"..arg[1]) + print("Rockspec created! Moving it into the ./downloaded_modules/"..arg[1].." folder") + os.execute("mv "..arg[1].."-scm-1.rockspec ./downloaded_modules/"..arg[1]) + print("Done!") + return 0 +end + function commands.list(arg) if not arg[1] or arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]); -- cgit v1.2.3 From 8fa4d6e25003773649665a5c9d4924b723a21fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 16 Jul 2019 10:26:44 -0700 Subject: prosodyctl: Added the 'make' function --- prosodyctl | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index baea969a..7f7b515e 100755 --- a/prosodyctl +++ b/prosodyctl @@ -129,6 +129,17 @@ function commands.write_rockspec(arg) return 0 end +-- Command to install a rockspec with local sources +-- The module is installed at the plugins folder +function commands.make(arg) + if arg[1] == "--help" then + show_usage([[make]], [[Installs a module with sources available locally]]); + return 1 + end + os.execute("cd downloaded_modules/"..arg[1].." && luarocks --tree='../../plugins' make "..arg[1].."-scm-1.rockspec") + return 0 +end + function commands.list(arg) if not arg[1] or arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]); -- cgit v1.2.3 From 5b190cf27618c048a69021dae3415727a50630e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 16 Jul 2019 10:34:13 -0700 Subject: prosodyctl: Added the 'remove' command --- prosodyctl | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 7f7b515e..dac0c1f9 100755 --- a/prosodyctl +++ b/prosodyctl @@ -140,6 +140,19 @@ function commands.make(arg) return 0 end +-- Command to remove a rockspec +-- Receives as an argument the name of the plugin to be removed from the plugins folder +function commands.remove(arg) + if arg[1] == "--help" then + show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); + return 1 + end + print("Removing "..arg[1].." from ./plugins") + os.execute("luarocks --tree='./plugins' remove "..arg[1]) + print("Done!") + return 0 +end + function commands.list(arg) if not arg[1] or arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]); -- cgit v1.2.3 From 344f333e82da80a66a357ba5b271043b504ada2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 17 Jul 2019 03:20:08 -0700 Subject: prosodyctl: Added the 'install' command --- prosodyctl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index dac0c1f9..f04c1d46 100755 --- a/prosodyctl +++ b/prosodyctl @@ -153,6 +153,16 @@ function commands.remove(arg) return 0 end +function commands.install(arg) + if arg[1] == "--help" then + show_usage([[make]], [[Installs a rockspec/rock from a specified server]]); + return 1 + end + print("Installing module "..arg[1].." locally, from luarocks repo") + os.execute("luarocks --tree='./plugins' install "..arg[1]) + return 0 +end + function commands.list(arg) if not arg[1] or arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]); -- cgit v1.2.3 From 184b2a45b80a03728038643d0c5ec1cfd70e617f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 17 Jul 2019 03:31:02 -0700 Subject: prosodyctl: Improved the 'list' command --- prosodyctl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index f04c1d46..750c84e4 100755 --- a/prosodyctl +++ b/prosodyctl @@ -164,7 +164,7 @@ function commands.install(arg) end function commands.list(arg) - if not arg[1] or arg[1] == "--help" then + if arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]); return 1; end @@ -174,10 +174,10 @@ function commands.list(arg) if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks list --tree=".."'"..dir.."'") + os.execute("luarocks list --tree='"..dir.."'") return 0; else - os.execute("luarocks list --tree="..prosody.paths.data.."/rocks") + os.execute("luarocks list --tree="..prosody.paths.plugins) return 0; end end -- cgit v1.2.3 From 213539ccd90da28856875c64bd41868cb818f2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 17 Jul 2019 03:45:26 -0700 Subject: prosodyctl: The 'install' command can now recognize the flag '--tree' --- prosodyctl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 750c84e4..a1dd1614 100755 --- a/prosodyctl +++ b/prosodyctl @@ -158,9 +158,20 @@ function commands.install(arg) show_usage([[make]], [[Installs a rockspec/rock from a specified server]]); return 1 end - print("Installing module "..arg[1].." locally, from luarocks repo") - os.execute("luarocks --tree='./plugins' install "..arg[1]) - return 0 + -- Need to think about the case with many flags + local flag = "--tree=" + -- I'm considering the flag is the first, but there can be many flags + if arg[1] and arg[1]:sub(1, #flag) == flag then + local dir = arg[1]:match("=(.+)$") + print("Installing module "..arg[2].." at "..dir..", from luarocks repo") + -- These extra double brackets allow us to correctly process names with spaces + os.execute("luarocks install --tree='"..dir.."' "..arg[2]) + return 0; + else + print("Installing module "..arg[1].." locally, from luarocks repo") + os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) + return 0 + end end function commands.list(arg) -- cgit v1.2.3 From efb9164e517ff5d95a6b82fd3cf416535b2fe3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 17 Jul 2019 09:03:15 -0700 Subject: prosodyctl: Improved the 'remove' command --- prosodyctl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index a1dd1614..af1fea54 100755 --- a/prosodyctl +++ b/prosodyctl @@ -147,10 +147,20 @@ function commands.remove(arg) show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1 end - print("Removing "..arg[1].." from ./plugins") - os.execute("luarocks --tree='./plugins' remove "..arg[1]) - print("Done!") - return 0 + local flag = "--tree=" + -- I'm considering the flag is the first, but there can be many flags + if arg[1] and arg[1]:sub(1, #flag) == flag then + local dir = arg[1]:match("=(.+)$") + print("Removing module "..arg[2].." at "..dir..", from luarocks repo") + -- These extra double brackets allow us to correctly process names with spaces + os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) + return 0; + else + print("Removing "..arg[1].." from ./plugins") + os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) + print("Done!") + return 0 + end end function commands.install(arg) -- cgit v1.2.3 From 5fa25a8910bcb012944b3abbc23b5904e8df46a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 17 Jul 2019 09:12:32 -0700 Subject: prosodyctl: Added missing semicolons to some return calls --- prosodyctl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index af1fea54..dea588a2 100755 --- a/prosodyctl +++ b/prosodyctl @@ -88,7 +88,7 @@ local command = table.remove(arg, 1); function commands.get_modules(arg) if arg[1] == "--help" then show_usage([[get_modules]], [[Downloads all available modules]]); - return 1 + return 1; end if os.execute '[ -e "./downloaded_modules" ]' then print("The modules have already been imported") @@ -100,16 +100,16 @@ function commands.get_modules(arg) print("Downloading plugins") os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") print("Done!") - return 0 + return 0; else print("We keep what we have then!") - return 0 + return 0; end else print("Getting all the available modules") os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") print("Done!") - return 0 + return 0; end end @@ -119,14 +119,14 @@ end function commands.write_rockspec(arg) if arg[1] == "--help" then show_usage([[write_rockspec]], [[Picks up a module and writes an initial rockspec]]); - return 1 + return 1; end print("Writing rockspec for "..arg[1]) os.execute("luarocks write_rockspec "..arg[1].." ./downloaded_modules/"..arg[1]) print("Rockspec created! Moving it into the ./downloaded_modules/"..arg[1].." folder") os.execute("mv "..arg[1].."-scm-1.rockspec ./downloaded_modules/"..arg[1]) print("Done!") - return 0 + return 0; end -- Command to install a rockspec with local sources @@ -134,10 +134,10 @@ end function commands.make(arg) if arg[1] == "--help" then show_usage([[make]], [[Installs a module with sources available locally]]); - return 1 + return 1; end os.execute("cd downloaded_modules/"..arg[1].." && luarocks --tree='../../plugins' make "..arg[1].."-scm-1.rockspec") - return 0 + return 0; end -- Command to remove a rockspec @@ -145,7 +145,7 @@ end function commands.remove(arg) if arg[1] == "--help" then show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); - return 1 + return 1; end local flag = "--tree=" -- I'm considering the flag is the first, but there can be many flags @@ -159,14 +159,14 @@ function commands.remove(arg) print("Removing "..arg[1].." from ./plugins") os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) print("Done!") - return 0 + return 0; end end function commands.install(arg) if arg[1] == "--help" then show_usage([[make]], [[Installs a rockspec/rock from a specified server]]); - return 1 + return 1; end -- Need to think about the case with many flags local flag = "--tree=" @@ -180,7 +180,7 @@ function commands.install(arg) else print("Installing module "..arg[1].." locally, from luarocks repo") os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) - return 0 + return 0; end end @@ -219,7 +219,7 @@ function commands.enabled_plugins(arg) return 1; end for module in modulemanager.get_modules_for_host() do - show_warning("%s", module) + show_warning("%s", module) end end @@ -241,7 +241,7 @@ function commands.local_plugins(arg) end end pfile:close() - return 0 + return 0; end function commands.adduser(arg) -- cgit v1.2.3 From cbeea7c2875da04e63c97727be48eaf689fc1745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 17 Jul 2019 09:47:37 -0700 Subject: prosodyctl: Removed trailing whitespaces --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index dea588a2..477ddcfe 100755 --- a/prosodyctl +++ b/prosodyctl @@ -219,7 +219,7 @@ function commands.enabled_plugins(arg) return 1; end for module in modulemanager.get_modules_for_host() do - show_warning("%s", module) + show_warning("%s", module) end end -- cgit v1.2.3 From aaac83292f531d4f5b540bc8e35e5e8999ae21cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Sat, 20 Jul 2019 12:41:06 -0700 Subject: prosodyctl: Corrected indentation on my code --- prosodyctl | 212 ++++++++++++++++++++++++++++++------------------------------- 1 file changed, 106 insertions(+), 106 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 477ddcfe..244a1a24 100755 --- a/prosodyctl +++ b/prosodyctl @@ -86,137 +86,137 @@ local command = table.remove(arg, 1); -- This function receives no arguments. It clones all the plugins from prosody's plugin repository function commands.get_modules(arg) - if arg[1] == "--help" then + if arg[1] == "--help" then show_usage([[get_modules]], [[Downloads all available modules]]); - return 1; - end - if os.execute '[ -e "./downloaded_modules" ]' then - print("The modules have already been imported") - print("Do you want to re-import?(Y/N)") - local answer = io.read() - if answer == "Y" then - print("Deleting previous imports") - os.execute("rm -rf downloaded_modules") - print("Downloading plugins") - os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - print("Done!") - return 0; - else - print("We keep what we have then!") - return 0; - end - else - print("Getting all the available modules") - os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - print("Done!") - return 0; - end + return 1; + end + if os.execute '[ -e "./downloaded_modules" ]' then + print("The modules have already been imported") + print("Do you want to re-import?(Y/N)") + local answer = io.read() + if answer == "Y" then + print("Deleting previous imports") + os.execute("rm -rf downloaded_modules") + print("Downloading plugins") + os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") + print("Done!") + return 0; + else + print("We keep what we have then!") + return 0; + end + else + print("Getting all the available modules") + os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") + print("Done!") + return 0; + end end -- Function to write rockspecs from a module at working_directory/downloaded_modules -- Receives the module's name as an argument -- The rockspec is saved inside its module's folder function commands.write_rockspec(arg) - if arg[1] == "--help" then - show_usage([[write_rockspec]], [[Picks up a module and writes an initial rockspec]]); - return 1; - end - print("Writing rockspec for "..arg[1]) - os.execute("luarocks write_rockspec "..arg[1].." ./downloaded_modules/"..arg[1]) - print("Rockspec created! Moving it into the ./downloaded_modules/"..arg[1].." folder") - os.execute("mv "..arg[1].."-scm-1.rockspec ./downloaded_modules/"..arg[1]) - print("Done!") - return 0; + if arg[1] == "--help" then + show_usage([[write_rockspec]], [[Picks up a module and writes an initial rockspec]]); + return 1; + end + print("Writing rockspec for "..arg[1]) + os.execute("luarocks write_rockspec "..arg[1].." ./downloaded_modules/"..arg[1]) + print("Rockspec created! Moving it into the ./downloaded_modules/"..arg[1].." folder") + os.execute("mv "..arg[1].."-scm-1.rockspec ./downloaded_modules/"..arg[1]) + print("Done!") + return 0; end -- Command to install a rockspec with local sources -- The module is installed at the plugins folder function commands.make(arg) - if arg[1] == "--help" then - show_usage([[make]], [[Installs a module with sources available locally]]); - return 1; - end - os.execute("cd downloaded_modules/"..arg[1].." && luarocks --tree='../../plugins' make "..arg[1].."-scm-1.rockspec") - return 0; + if arg[1] == "--help" then + show_usage([[make]], [[Installs a module with sources available locally]]); + return 1; + end + os.execute("cd downloaded_modules/"..arg[1].." && luarocks --tree='../../plugins' make "..arg[1].."-scm-1.rockspec") + return 0; end -- Command to remove a rockspec -- Receives as an argument the name of the plugin to be removed from the plugins folder function commands.remove(arg) - if arg[1] == "--help" then - show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); - return 1; - end - local flag = "--tree=" - -- I'm considering the flag is the first, but there can be many flags - if arg[1] and arg[1]:sub(1, #flag) == flag then - local dir = arg[1]:match("=(.+)$") - print("Removing module "..arg[2].." at "..dir..", from luarocks repo") - -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) - return 0; - else - print("Removing "..arg[1].." from ./plugins") - os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) - print("Done!") - return 0; - end + if arg[1] == "--help" then + show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); + return 1; + end + local flag = "--tree=" + -- I'm considering the flag is the first, but there can be many flags + if arg[1] and arg[1]:sub(1, #flag) == flag then + local dir = arg[1]:match("=(.+)$") + print("Removing module "..arg[2].." at "..dir..", from luarocks repo") + -- These extra double brackets allow us to correctly process names with spaces + os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) + return 0; + else + print("Removing "..arg[1].." from ./plugins") + os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) + print("Done!") + return 0; + end end function commands.install(arg) - if arg[1] == "--help" then - show_usage([[make]], [[Installs a rockspec/rock from a specified server]]); - return 1; - end - -- Need to think about the case with many flags - local flag = "--tree=" - -- I'm considering the flag is the first, but there can be many flags - if arg[1] and arg[1]:sub(1, #flag) == flag then - local dir = arg[1]:match("=(.+)$") - print("Installing module "..arg[2].." at "..dir..", from luarocks repo") - -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks install --tree='"..dir.."' "..arg[2]) - return 0; - else - print("Installing module "..arg[1].." locally, from luarocks repo") - os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) - return 0; - end + if arg[1] == "--help" then + show_usage([[make]], [[Installs a rockspec/rock from a specified server]]); + return 1; + end + -- Need to think about the case with many flags + local flag = "--tree=" + -- I'm considering the flag is the first, but there can be many flags + if arg[1] and arg[1]:sub(1, #flag) == flag then + local dir = arg[1]:match("=(.+)$") + print("Installing module "..arg[2].." at "..dir..", from luarocks repo") + -- These extra double brackets allow us to correctly process names with spaces + os.execute("luarocks install --tree='"..dir.."' "..arg[2]) + return 0; + else + print("Installing module "..arg[1].." locally, from luarocks repo") + os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) + return 0; + end end function commands.list(arg) - if arg[1] == "--help" then + if arg[1] == "--help" then show_usage([[list]], [[Shows installed rocks]]); return 1; end - -- Need to think about the case with many flags - local flag = "--tree=" - -- I'm considering the flag is the first, but there can be many flags - if arg[1] and arg[1]:sub(1, #flag) == flag then - local dir = arg[1]:match("=(.+)$") - -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks list --tree='"..dir.."'") - return 0; - else - os.execute("luarocks list --tree="..prosody.paths.plugins) - return 0; - end + -- Need to think about the case with many flags + local flag = "--tree=" + -- I'm considering the flag is the first, but there can be many flags + if arg[1] and arg[1]:sub(1, #flag) == flag then + local dir = arg[1]:match("=(.+)$") + -- These extra double brackets allow us to correctly process names with spaces + os.execute("luarocks list --tree='"..dir.."'") + return 0; + else + os.execute("luarocks list --tree="..prosody.paths.plugins) + return 0; + end end function commands.admin_add(arg) - prosodyctl.admin_operation("add ", arg) - return 0; + prosodyctl.admin_operation("add ", arg) + return 0; end function commands.admin_remove(arg) - prosodyctl.admin_operation("remove ", arg) - return 0; + prosodyctl.admin_operation("remove ", arg) + return 0; end function commands.enabled_plugins(arg) - if arg[1] == "--help" then - show_usage([[enabled_plugins]], [[Shows plugins currently enabled on prosody]]); - return 1; + if arg[1] == "--help" then + show_usage([[enabled_plugins]], [[Shows plugins currently enabled on prosody]]); + return 1; end for module in modulemanager.get_modules_for_host() do show_warning("%s", module) @@ -224,24 +224,24 @@ function commands.enabled_plugins(arg) end function commands.local_plugins(arg) - if arg[1] == "--help" then - show_usage([[local_plugins]], [[Shows plugins currently available for prosody, locally]]); - return 1; + if arg[1] == "--help" then + show_usage([[local_plugins]], [[Shows plugins currently available for prosody, locally]]); + return 1; end local directory = "./plugins" - local i, t, popen = 0, {}, io.popen - local pfile = popen('ls -a "'..directory..'"') - for filename in pfile:lines() do + local i, t, popen = 0, {}, io.popen + local pfile = popen('ls -a "'..directory..'"') + for filename in pfile:lines() do if filename == "." or filename == ".." then i = i + 1 else i = i + 1 t[i] = filename show_warning("%s", t[i]) - end - end - pfile:close() - return 0; + end + end + pfile:close() + return 0; end function commands.adduser(arg) -- cgit v1.2.3 From 9da55591971c39bbc5f3c8d24b521be89dc51897 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 23 Jul 2019 07:21:08 -0700 Subject: prosodyctl: Corrected output printed by the remove command --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 244a1a24..4831150c 100755 --- a/prosodyctl +++ b/prosodyctl @@ -151,12 +151,12 @@ function commands.remove(arg) -- I'm considering the flag is the first, but there can be many flags if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") - print("Removing module "..arg[2].." at "..dir..", from luarocks repo") + print("Removing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) return 0; else - print("Removing "..arg[1].." from ./plugins") + print("Removing "..arg[1].." from "..prosody.paths.plugins) os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) print("Done!") return 0; -- cgit v1.2.3 From 94ba83d8e657ba8c934c1875dac049f2f4f38101 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 23 Jul 2019 08:36:06 -0700 Subject: prosodyctl: Corrected the outputs from the install command --- prosodyctl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 4831150c..820a274f 100755 --- a/prosodyctl +++ b/prosodyctl @@ -165,7 +165,7 @@ end function commands.install(arg) if arg[1] == "--help" then - show_usage([[make]], [[Installs a rockspec/rock from a specified server]]); + show_usage([[make]], [[Installs a prosody/luarocks plugin]]); return 1; end -- Need to think about the case with many flags @@ -173,12 +173,12 @@ function commands.install(arg) -- I'm considering the flag is the first, but there can be many flags if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") - print("Installing module "..arg[2].." at "..dir..", from luarocks repo") + print("Installing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces os.execute("luarocks install --tree='"..dir.."' "..arg[2]) return 0; else - print("Installing module "..arg[1].." locally, from luarocks repo") + print("Installing module "..arg[1].." at "..prosody.paths.plugins) os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) return 0; end -- cgit v1.2.3 From d5026a6f633fddc5c459a6e63b3568c073029387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 23 Jul 2019 08:48:31 -0700 Subject: prosodyctl: The install command is now also checking a specified remote server --- prosodyctl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 820a274f..f485f517 100755 --- a/prosodyctl +++ b/prosodyctl @@ -175,11 +175,13 @@ function commands.install(arg) local dir = arg[1]:match("=(.+)$") print("Installing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks install --tree='"..dir.."' "..arg[2]) + os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) return 0; else print("Installing module "..arg[1].." at "..prosody.paths.plugins) - os.execute("luarocks --tree='"..prosody.paths.plugins.."' install "..arg[1]) + -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from + -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules + os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) return 0; end end -- cgit v1.2.3 From a935d786f3ad27b543eae92d8ac404442c2cc6ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 23 Jul 2019 10:26:00 -0700 Subject: prosodyctl: The install command now prints output regarding module configuration --- prosodyctl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index f485f517..26d6a850 100755 --- a/prosodyctl +++ b/prosodyctl @@ -76,6 +76,7 @@ local show_usage = prosodyctl.show_usage; local show_yesno = prosodyctl.show_yesno; local show_prompt = prosodyctl.show_prompt; local read_password = prosodyctl.read_password; +local show_module_configuration_help = prosodyctl.show_module_configuration_help; local jid_split = require "util.jid".prepped_split; @@ -176,12 +177,14 @@ function commands.install(arg) print("Installing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) + show_module_configuration_help(arg[2]); return 0; else print("Installing module "..arg[1].." at "..prosody.paths.plugins) -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) + show_module_configuration_help(arg[1]); return 0; end end -- cgit v1.2.3 From ecd9e8f5d771da2fffa4721df0880756c2203714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Tue, 23 Jul 2019 13:27:19 -0700 Subject: prosodyctl: Created a temporary function, that automatically sets up a repo with rockspecs for prosody modules --- prosodyctl | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 26d6a850..13494bb8 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,6 +85,43 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); +function commands.magic(arg) + --print("Getting all the available modules") + --os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") + local i, popen = 0, io.popen + local flag = "mod_" + os.execute("mkdir repository") + local pfile = popen('ls -a "'..arg[1]..'"') + for filename in pfile:lines() do + i = i + 1 + if filename:sub(1, #flag) == flag then + local file = io.open("repository/"..filename.."-scm-1.rockspec", "w") + file:write('package = "'..filename..'"', '\n') + file:write('version = "scm-1"', '\n') + file:write('source = {', '\n') + file:write('\turl = "hg+https://hg.prosody.im/prosody-modules",', '\n') + file:write('\tdir = "prosody-modules"', '\n') + file:write('}', '\n') + file:write('description = {', '\n') + file:write('\thomepage = "https://prosody.im/",', '\n') + file:write('\tlicense = "MIT"', '\n') + file:write('}', '\n') + file:write('dependencies = {', '\n') + file:write('\t"lua >= 5.1"', '\n') + file:write('}', '\n') + file:write('build = {', '\n') + file:write('\ttype = "builtin",', '\n') + file:write('\tmodules = {', '\n') + file:write('\t\t["'..filename..'.'..filename..'"] = "'..filename..'/'..filename..'.lua"', '\n') + file:write('\t}', '\n') + file:write('}', '\n') + file:close() + end + end + pfile:close() + os.execute("cd repository/ && luarocks-admin make_manifest ./ && chmod -R 644 ./*") +end + -- This function receives no arguments. It clones all the plugins from prosody's plugin repository function commands.get_modules(arg) if arg[1] == "--help" then -- cgit v1.2.3 From 447b7f8731db9be3caab0e8500caa2cafe168ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 04:24:29 -0700 Subject: prosodyctl: Removed the development commands magic, get_modules and write_rockspec --- prosodyctl | 82 -------------------------------------------------------------- 1 file changed, 82 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 13494bb8..420337da 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,88 +85,6 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); -function commands.magic(arg) - --print("Getting all the available modules") - --os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - local i, popen = 0, io.popen - local flag = "mod_" - os.execute("mkdir repository") - local pfile = popen('ls -a "'..arg[1]..'"') - for filename in pfile:lines() do - i = i + 1 - if filename:sub(1, #flag) == flag then - local file = io.open("repository/"..filename.."-scm-1.rockspec", "w") - file:write('package = "'..filename..'"', '\n') - file:write('version = "scm-1"', '\n') - file:write('source = {', '\n') - file:write('\turl = "hg+https://hg.prosody.im/prosody-modules",', '\n') - file:write('\tdir = "prosody-modules"', '\n') - file:write('}', '\n') - file:write('description = {', '\n') - file:write('\thomepage = "https://prosody.im/",', '\n') - file:write('\tlicense = "MIT"', '\n') - file:write('}', '\n') - file:write('dependencies = {', '\n') - file:write('\t"lua >= 5.1"', '\n') - file:write('}', '\n') - file:write('build = {', '\n') - file:write('\ttype = "builtin",', '\n') - file:write('\tmodules = {', '\n') - file:write('\t\t["'..filename..'.'..filename..'"] = "'..filename..'/'..filename..'.lua"', '\n') - file:write('\t}', '\n') - file:write('}', '\n') - file:close() - end - end - pfile:close() - os.execute("cd repository/ && luarocks-admin make_manifest ./ && chmod -R 644 ./*") -end - --- This function receives no arguments. It clones all the plugins from prosody's plugin repository -function commands.get_modules(arg) - if arg[1] == "--help" then - show_usage([[get_modules]], [[Downloads all available modules]]); - return 1; - end - if os.execute '[ -e "./downloaded_modules" ]' then - print("The modules have already been imported") - print("Do you want to re-import?(Y/N)") - local answer = io.read() - if answer == "Y" then - print("Deleting previous imports") - os.execute("rm -rf downloaded_modules") - print("Downloading plugins") - os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - print("Done!") - return 0; - else - print("We keep what we have then!") - return 0; - end - else - print("Getting all the available modules") - os.execute("hg clone https://hg.prosody.im/prosody-modules/ downloaded_modules") - print("Done!") - return 0; - end -end - --- Function to write rockspecs from a module at working_directory/downloaded_modules --- Receives the module's name as an argument --- The rockspec is saved inside its module's folder -function commands.write_rockspec(arg) - if arg[1] == "--help" then - show_usage([[write_rockspec]], [[Picks up a module and writes an initial rockspec]]); - return 1; - end - print("Writing rockspec for "..arg[1]) - os.execute("luarocks write_rockspec "..arg[1].." ./downloaded_modules/"..arg[1]) - print("Rockspec created! Moving it into the ./downloaded_modules/"..arg[1].." folder") - os.execute("mv "..arg[1].."-scm-1.rockspec ./downloaded_modules/"..arg[1]) - print("Done!") - return 0; -end - -- Command to install a rockspec with local sources -- The module is installed at the plugins folder function commands.make(arg) -- cgit v1.2.3 From d38ebec46613682f618c932b1ab16b6ca5f9e6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 04:42:45 -0700 Subject: prosodyctl: Removed the make, admin_add and admin_remove commands --- prosodyctl | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 420337da..14db6c29 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,17 +85,6 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); --- Command to install a rockspec with local sources --- The module is installed at the plugins folder -function commands.make(arg) - if arg[1] == "--help" then - show_usage([[make]], [[Installs a module with sources available locally]]); - return 1; - end - os.execute("cd downloaded_modules/"..arg[1].." && luarocks --tree='../../plugins' make "..arg[1].."-scm-1.rockspec") - return 0; -end - -- Command to remove a rockspec -- Receives as an argument the name of the plugin to be removed from the plugins folder function commands.remove(arg) @@ -163,16 +152,6 @@ function commands.list(arg) end end -function commands.admin_add(arg) - prosodyctl.admin_operation("add ", arg) - return 0; -end - -function commands.admin_remove(arg) - prosodyctl.admin_operation("remove ", arg) - return 0; -end - function commands.enabled_plugins(arg) if arg[1] == "--help" then show_usage([[enabled_plugins]], [[Shows plugins currently enabled on prosody]]); -- cgit v1.2.3 From b291e91de25427e836f74cb41ab9ee644fd510c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 04:53:02 -0700 Subject: prosodyctl: Removed the admin_add and admin_remove from the commands_order variable --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 14db6c29..ae73ed54 100755 --- a/prosodyctl +++ b/prosodyctl @@ -1448,8 +1448,8 @@ local command_runner = async.runner(function () print("Where COMMAND may be one of:\n"); local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; - local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", "about", "local_plugins", "enabled_plugins", - "admin_add", "admin_remove", "list", }; + local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", "about", "local_plugins", + "enabled_plugins", "list"}; local done = {}; -- cgit v1.2.3 From e1969065c487c60fa6df682d2aca5614d2dae690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 04:59:46 -0700 Subject: prosodyctl: Added the install and remove arguments to the reorganized commands_order variable --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index ae73ed54..905e00cf 100755 --- a/prosodyctl +++ b/prosodyctl @@ -1448,8 +1448,8 @@ local command_runner = async.runner(function () print("Where COMMAND may be one of:\n"); local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; - local commands_order = { "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", "about", "local_plugins", - "enabled_plugins", "list"}; + local commands_order = { "install", "remove", "list", "enabled_plugins", "local_plugins","adduser", "passwd", "deluser", "start", "stop", "restart", + "reload", "about", "list" }; local done = {}; -- cgit v1.2.3 From f736aec6b2c3062216b6f7481bd80a2444ffc36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 05:01:35 -0700 Subject: prosodyctl: Corrected the remove and install commands' order --- prosodyctl | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 905e00cf..2fd3084d 100755 --- a/prosodyctl +++ b/prosodyctl @@ -85,50 +85,50 @@ local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * local commands = {}; local command = table.remove(arg, 1); --- Command to remove a rockspec --- Receives as an argument the name of the plugin to be removed from the plugins folder -function commands.remove(arg) +function commands.install(arg) if arg[1] == "--help" then - show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); + show_usage([[make]], [[Installs a prosody/luarocks plugin]]); return 1; end + -- Need to think about the case with many flags local flag = "--tree=" -- I'm considering the flag is the first, but there can be many flags if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") - print("Removing module "..arg[2].." at "..dir) + print("Installing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) + os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) + show_module_configuration_help(arg[2]); return 0; else - print("Removing "..arg[1].." from "..prosody.paths.plugins) - os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) - print("Done!") + print("Installing module "..arg[1].." at "..prosody.paths.plugins) + -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from + -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules + os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) + show_module_configuration_help(arg[1]); return 0; end end -function commands.install(arg) +-- Command to remove a rockspec +-- Receives as an argument the name of the plugin to be removed from the plugins folder +function commands.remove(arg) if arg[1] == "--help" then - show_usage([[make]], [[Installs a prosody/luarocks plugin]]); + show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end - -- Need to think about the case with many flags local flag = "--tree=" -- I'm considering the flag is the first, but there can be many flags if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") - print("Installing module "..arg[2].." at "..dir) + print("Removing module "..arg[2].." at "..dir) -- These extra double brackets allow us to correctly process names with spaces - os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) - show_module_configuration_help(arg[2]); + os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) return 0; else - print("Installing module "..arg[1].." at "..prosody.paths.plugins) - -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from - -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules - os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) - show_module_configuration_help(arg[1]); + print("Removing "..arg[1].." from "..prosody.paths.plugins) + os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) + print("Done!") return 0; end end -- cgit v1.2.3 From 46ae143d9a6a51b72365b8d2781e7d45d8e332c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 05:07:57 -0700 Subject: prosodyctl: Removed/rewrote comments at the install, remove and list commands --- prosodyctl | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 2fd3084d..be6df959 100755 --- a/prosodyctl +++ b/prosodyctl @@ -90,13 +90,11 @@ function commands.install(arg) show_usage([[make]], [[Installs a prosody/luarocks plugin]]); return 1; end - -- Need to think about the case with many flags + -- I'm considering this optional flag comes first local flag = "--tree=" - -- I'm considering the flag is the first, but there can be many flags if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") print("Installing module "..arg[2].." at "..dir) - -- These extra double brackets allow us to correctly process names with spaces os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) show_module_configuration_help(arg[2]); return 0; @@ -110,19 +108,16 @@ function commands.install(arg) end end --- Command to remove a rockspec --- Receives as an argument the name of the plugin to be removed from the plugins folder function commands.remove(arg) if arg[1] == "--help" then show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end local flag = "--tree=" - -- I'm considering the flag is the first, but there can be many flags + -- I'm considering this optional flag comes first if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") print("Removing module "..arg[2].." at "..dir) - -- These extra double brackets allow us to correctly process names with spaces os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) return 0; else @@ -138,12 +133,10 @@ function commands.list(arg) show_usage([[list]], [[Shows installed rocks]]); return 1; end - -- Need to think about the case with many flags local flag = "--tree=" - -- I'm considering the flag is the first, but there can be many flags + -- I'm considering this optional flag comes first if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") - -- These extra double brackets allow us to correctly process names with spaces os.execute("luarocks list --tree='"..dir.."'") return 0; else -- cgit v1.2.3 From 27e711c5876b0008fa871b26787c0c134e90d744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 10:43:28 -0700 Subject: prosodyctl: The install command now performs its job at a dedicated folder for custom plugins --- prosodyctl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index be6df959..1c702576 100755 --- a/prosodyctl +++ b/prosodyctl @@ -90,6 +90,12 @@ function commands.install(arg) show_usage([[make]], [[Installs a prosody/luarocks plugin]]); return 1; end + local installer_plugin_path + -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now + for path in prosody.paths.plugins:gmatch("[^;]+") do + installer_plugin_path = path + break + end -- I'm considering this optional flag comes first local flag = "--tree=" if arg[1] and arg[1]:sub(1, #flag) == flag then @@ -99,10 +105,10 @@ function commands.install(arg) show_module_configuration_help(arg[2]); return 0; else - print("Installing module "..arg[1].." at "..prosody.paths.plugins) + print("Installing module "..arg[1].." at "..installer_plugin_path) -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules - os.execute("luarocks --tree='"..prosody.paths.plugins.."' --server='http://localhost/' install "..arg[1]) + os.execute("luarocks --tree='"..installer_plugin_path.."' --server='http://localhost/' install "..arg[1]) show_module_configuration_help(arg[1]); return 0; end -- cgit v1.2.3 From cf695f88f1bc15c7ccb69c65aee555579ad80da8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 10:46:05 -0700 Subject: prosodyctl: Updated the remove command to use the new directory for custom plugins --- prosodyctl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 1c702576..33f58fc1 100755 --- a/prosodyctl +++ b/prosodyctl @@ -119,6 +119,11 @@ function commands.remove(arg) show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end + -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now + for path in prosody.paths.plugins:gmatch("[^;]+") do + installer_plugin_path = path + break + end local flag = "--tree=" -- I'm considering this optional flag comes first if arg[1] and arg[1]:sub(1, #flag) == flag then @@ -127,8 +132,8 @@ function commands.remove(arg) os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) return 0; else - print("Removing "..arg[1].." from "..prosody.paths.plugins) - os.execute("luarocks --tree='"..prosody.paths.plugins.."' remove "..arg[1]) + print("Removing "..arg[1].." from "..installer_plugin_path) + os.execute("luarocks --tree='"..installer_plugin_path.."' remove "..arg[1]) print("Done!") return 0; end -- cgit v1.2.3 From f1a27b4554175c04fbd3c5ffedbc5b9e6ad40967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 10:48:20 -0700 Subject: prosodyctl: Updated the list command, to use the new directory for custom plugins --- prosodyctl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 33f58fc1..777b2c30 100755 --- a/prosodyctl +++ b/prosodyctl @@ -144,6 +144,11 @@ function commands.list(arg) show_usage([[list]], [[Shows installed rocks]]); return 1; end + -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now + for path in prosody.paths.plugins:gmatch("[^;]+") do + installer_plugin_path = path + break + end local flag = "--tree=" -- I'm considering this optional flag comes first if arg[1] and arg[1]:sub(1, #flag) == flag then @@ -151,7 +156,7 @@ function commands.list(arg) os.execute("luarocks list --tree='"..dir.."'") return 0; else - os.execute("luarocks list --tree="..prosody.paths.plugins) + os.execute("luarocks list --tree="..installer_plugin_path) return 0; end end -- cgit v1.2.3 From 843f28994734b5791eb1f011dd60de87e2b2fa7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 11:26:29 -0700 Subject: prosodyctl: Custom plugins paths are now retrieved by an helper function --- prosodyctl | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 777b2c30..c50900f2 100755 --- a/prosodyctl +++ b/prosodyctl @@ -90,12 +90,7 @@ function commands.install(arg) show_usage([[make]], [[Installs a prosody/luarocks plugin]]); return 1; end - local installer_plugin_path - -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now - for path in prosody.paths.plugins:gmatch("[^;]+") do - installer_plugin_path = path - break - end + local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) -- I'm considering this optional flag comes first local flag = "--tree=" if arg[1] and arg[1]:sub(1, #flag) == flag then @@ -120,10 +115,7 @@ function commands.remove(arg) return 1; end -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now - for path in prosody.paths.plugins:gmatch("[^;]+") do - installer_plugin_path = path - break - end + local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) local flag = "--tree=" -- I'm considering this optional flag comes first if arg[1] and arg[1]:sub(1, #flag) == flag then @@ -145,10 +137,7 @@ function commands.list(arg) return 1; end -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now - for path in prosody.paths.plugins:gmatch("[^;]+") do - installer_plugin_path = path - break - end + local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) local flag = "--tree=" -- I'm considering this optional flag comes first if arg[1] and arg[1]:sub(1, #flag) == flag then -- cgit v1.2.3 From d93db0b931b21e041baf0badb7b5224ebced7a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 24 Jul 2019 11:29:55 -0700 Subject: prosodyctl: Removed the local_plugins command --- prosodyctl | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index c50900f2..cf51ca7d 100755 --- a/prosodyctl +++ b/prosodyctl @@ -160,27 +160,6 @@ function commands.enabled_plugins(arg) end end -function commands.local_plugins(arg) - if arg[1] == "--help" then - show_usage([[local_plugins]], [[Shows plugins currently available for prosody, locally]]); - return 1; - end - local directory = "./plugins" - local i, t, popen = 0, {}, io.popen - local pfile = popen('ls -a "'..directory..'"') - for filename in pfile:lines() do - if filename == "." or filename == ".." then - i = i + 1 - else - i = i + 1 - t[i] = filename - show_warning("%s", t[i]) - end - end - pfile:close() - return 0; -end - function commands.adduser(arg) if not arg[1] or arg[1] == "--help" then show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); @@ -1446,8 +1425,8 @@ local command_runner = async.runner(function () print("Where COMMAND may be one of:\n"); local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; - local commands_order = { "install", "remove", "list", "enabled_plugins", "local_plugins","adduser", "passwd", "deluser", "start", "stop", "restart", - "reload", "about", "list" }; + local commands_order = { "install", "remove", "list", "enabled_plugins", "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", + "about", "list" }; local done = {}; -- cgit v1.2.3 From 47421968357f79d18b68ca8999bc1c17b8a786e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Thu, 25 Jul 2019 04:25:40 -0700 Subject: prosodyctl: Removed the list duplicate at the commands_order variable --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index cf51ca7d..54e883b2 100755 --- a/prosodyctl +++ b/prosodyctl @@ -1426,7 +1426,7 @@ local command_runner = async.runner(function () local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; local commands_order = { "install", "remove", "list", "enabled_plugins", "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", - "about", "list" }; + "about" }; local done = {}; -- cgit v1.2.3 From 449256fa0c00cce042fe8dc1a2b18bcbc0c07258 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 26 Jul 2019 05:53:18 -0700 Subject: prosodyctl: Corrected the help output of the install and remove commands --- prosodyctl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 54e883b2..9990a485 100755 --- a/prosodyctl +++ b/prosodyctl @@ -87,7 +87,7 @@ local command = table.remove(arg, 1); function commands.install(arg) if arg[1] == "--help" then - show_usage([[make]], [[Installs a prosody/luarocks plugin]]); + show_usage([[install]], [[Installs a prosody/luarocks plugin]]); return 1; end local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) @@ -111,7 +111,7 @@ end function commands.remove(arg) if arg[1] == "--help" then - show_usage([[make]], [[Removes a module installed in the wroking directory's plugins folder]]); + show_usage([[remove]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now -- cgit v1.2.3 From 1e03cec66433732be858cca013ce8c9f84169c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 31 Jul 2019 05:47:36 -0700 Subject: prosodyctl: Swapped prints for the show_message function at the install/remove commands --- prosodyctl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 9990a485..72f7cbb5 100755 --- a/prosodyctl +++ b/prosodyctl @@ -95,12 +95,12 @@ function commands.install(arg) local flag = "--tree=" if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") - print("Installing module "..arg[2].." at "..dir) + show_message("Installing module %s at %s", arg[2], dir) os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) show_module_configuration_help(arg[2]); return 0; else - print("Installing module "..arg[1].." at "..installer_plugin_path) + show_message("Installing module %s at %s", arg[1], installer_plugin_path) -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules os.execute("luarocks --tree='"..installer_plugin_path.."' --server='http://localhost/' install "..arg[1]) @@ -120,13 +120,12 @@ function commands.remove(arg) -- I'm considering this optional flag comes first if arg[1] and arg[1]:sub(1, #flag) == flag then local dir = arg[1]:match("=(.+)$") - print("Removing module "..arg[2].." at "..dir) + show_message("Removing module %s at %s", arg[2], dir) os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) return 0; else - print("Removing "..arg[1].." from "..installer_plugin_path) + show_message("Removing %s from %s", arg[1], installer_plugin_path) os.execute("luarocks --tree='"..installer_plugin_path.."' remove "..arg[1]) - print("Done!") return 0; end end -- cgit v1.2.3 From 372a90aff6bb86406df0e56f65ff0427b7b01172 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 31 Jul 2019 05:55:32 -0700 Subject: prosodyctl: Removed unnecessary comments from the remove command --- prosodyctl | 1 - 1 file changed, 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 72f7cbb5..24874ade 100755 --- a/prosodyctl +++ b/prosodyctl @@ -114,7 +114,6 @@ function commands.remove(arg) show_usage([[remove]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end - -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) local flag = "--tree=" -- I'm considering this optional flag comes first -- cgit v1.2.3 From 7e472f4b26c85841e3306cf46b3bfd378dabca25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 31 Jul 2019 07:31:03 -0700 Subject: prosodyctl: Rewrote the install command, to make it more cleaner --- prosodyctl | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 24874ade..18db72b7 100755 --- a/prosodyctl +++ b/prosodyctl @@ -76,7 +76,9 @@ local show_usage = prosodyctl.show_usage; local show_yesno = prosodyctl.show_yesno; local show_prompt = prosodyctl.show_prompt; local read_password = prosodyctl.read_password; -local show_module_configuration_help = prosodyctl.show_module_configuration_help; +local check_flags = prosodyctl.check_flags; +local call_luarocks = prosodyctl.call_luarocks; +local get_path_custom_plugins = prosodyctl.get_path_custom_plugins; local jid_split = require "util.jid".prepped_split; @@ -90,21 +92,14 @@ function commands.install(arg) show_usage([[install]], [[Installs a prosody/luarocks plugin]]); return 1; end - local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) - -- I'm considering this optional flag comes first - local flag = "--tree=" - if arg[1] and arg[1]:sub(1, #flag) == flag then - local dir = arg[1]:match("=(.+)$") - show_message("Installing module %s at %s", arg[2], dir) - os.execute("luarocks --tree='"..dir.."' --server='http://localhost/' install "..arg[2]) - show_module_configuration_help(arg[2]); + local operation = "install"; + local tree, mod, dir = check_flags(arg); + if tree then + call_luarocks(operation, mod, dir); return 0; else - show_message("Installing module %s at %s", arg[1], installer_plugin_path) - -- I've build a local server to upload some new rockspecs, like mod_smacks'. We can replace this server by one from - -- prosody's, where we can oficially disbrute rocks/rockspecs for all modules - os.execute("luarocks --tree='"..installer_plugin_path.."' --server='http://localhost/' install "..arg[1]) - show_module_configuration_help(arg[1]); + dir = get_path_custom_plugins(prosody.paths.plugins); + call_luarocks(operation, mod, dir); return 0; end end -- cgit v1.2.3 From f74f2d0d17b792139c85d44cbb4a64939bd2347e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 31 Jul 2019 10:07:22 -0700 Subject: prosodyctl: Rewrote the remove command, to make it cleaner and easier to work with --- prosodyctl | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 18db72b7..b92b166b 100755 --- a/prosodyctl +++ b/prosodyctl @@ -109,17 +109,14 @@ function commands.remove(arg) show_usage([[remove]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end - local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) - local flag = "--tree=" - -- I'm considering this optional flag comes first - if arg[1] and arg[1]:sub(1, #flag) == flag then - local dir = arg[1]:match("=(.+)$") - show_message("Removing module %s at %s", arg[2], dir) - os.execute("luarocks remove --tree='"..dir.."' "..arg[2]) + local operation = "remove"; + local tree, mod, dir = check_flags(arg); + if tree then + call_luarocks(operation, mod, dir); return 0; else - show_message("Removing %s from %s", arg[1], installer_plugin_path) - os.execute("luarocks --tree='"..installer_plugin_path.."' remove "..arg[1]) + dir = get_path_custom_plugins(prosody.paths.plugins); + call_luarocks(operation, mod, dir); return 0; end end -- cgit v1.2.3 From 849165ba69da619e45f7d4da5e0ae2554cea35a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 31 Jul 2019 10:22:40 -0700 Subject: prosodyctl: Rewrote the list command, to make it cleaner and easier to work with --- prosodyctl | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index b92b166b..c0690293 100755 --- a/prosodyctl +++ b/prosodyctl @@ -126,16 +126,14 @@ function commands.list(arg) show_usage([[list]], [[Shows installed rocks]]); return 1; end - -- I'm considering that we are using just one path to custom plugins, and it is the first in prosody.paths.plugins, for now - local installer_plugin_path = prosodyctl.get_path_custom_plugins(prosody.paths.plugins) - local flag = "--tree=" - -- I'm considering this optional flag comes first - if arg[1] and arg[1]:sub(1, #flag) == flag then - local dir = arg[1]:match("=(.+)$") - os.execute("luarocks list --tree='"..dir.."'") + local operation = "list"; + local tree, mod, dir = check_flags(arg); + if tree then + call_luarocks(operation, mod, dir); return 0; else - os.execute("luarocks list --tree="..installer_plugin_path) + dir = get_path_custom_plugins(prosody.paths.plugins); + call_luarocks(operation, mod, dir); return 0; end end -- cgit v1.2.3 From 5ba7a798fbf368a845cfc3fd04c3241d29f75d53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 31 Jul 2019 11:01:36 -0700 Subject: prosodyctl: The install, remove and list commands now work by calling the execute_command function --- prosodyctl | 40 +++++++--------------------------------- 1 file changed, 7 insertions(+), 33 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index c0690293..57632964 100755 --- a/prosodyctl +++ b/prosodyctl @@ -76,9 +76,7 @@ local show_usage = prosodyctl.show_usage; local show_yesno = prosodyctl.show_yesno; local show_prompt = prosodyctl.show_prompt; local read_password = prosodyctl.read_password; -local check_flags = prosodyctl.check_flags; -local call_luarocks = prosodyctl.call_luarocks; -local get_path_custom_plugins = prosodyctl.get_path_custom_plugins; +local execute_command = prosodyctl.execute_command; local jid_split = require "util.jid".prepped_split; @@ -92,16 +90,8 @@ function commands.install(arg) show_usage([[install]], [[Installs a prosody/luarocks plugin]]); return 1; end - local operation = "install"; - local tree, mod, dir = check_flags(arg); - if tree then - call_luarocks(operation, mod, dir); - return 0; - else - dir = get_path_custom_plugins(prosody.paths.plugins); - call_luarocks(operation, mod, dir); - return 0; - end + table.insert(arg, "install"); + execute_command(arg); end function commands.remove(arg) @@ -109,16 +99,8 @@ function commands.remove(arg) show_usage([[remove]], [[Removes a module installed in the wroking directory's plugins folder]]); return 1; end - local operation = "remove"; - local tree, mod, dir = check_flags(arg); - if tree then - call_luarocks(operation, mod, dir); - return 0; - else - dir = get_path_custom_plugins(prosody.paths.plugins); - call_luarocks(operation, mod, dir); - return 0; - end + table.insert(arg, "remove"); + execute_command(arg); end function commands.list(arg) @@ -126,16 +108,8 @@ function commands.list(arg) show_usage([[list]], [[Shows installed rocks]]); return 1; end - local operation = "list"; - local tree, mod, dir = check_flags(arg); - if tree then - call_luarocks(operation, mod, dir); - return 0; - else - dir = get_path_custom_plugins(prosody.paths.plugins); - call_luarocks(operation, mod, dir); - return 0; - end + table.insert(arg, "list"); + execute_command(arg); end function commands.enabled_plugins(arg) -- cgit v1.2.3 From 3fe8683f5ec784091353788cf7f1b722747e489a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Wed, 31 Jul 2019 11:13:14 -0700 Subject: prosodyctl: Removed the auxiliary command 'enabled_plugins' --- prosodyctl | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 57632964..9c94fea4 100755 --- a/prosodyctl +++ b/prosodyctl @@ -112,16 +112,6 @@ function commands.list(arg) execute_command(arg); end -function commands.enabled_plugins(arg) - if arg[1] == "--help" then - show_usage([[enabled_plugins]], [[Shows plugins currently enabled on prosody]]); - return 1; - end - for module in modulemanager.get_modules_for_host() do - show_warning("%s", module) - end -end - function commands.adduser(arg) if not arg[1] or arg[1] == "--help" then show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); @@ -1387,7 +1377,7 @@ local command_runner = async.runner(function () print("Where COMMAND may be one of:\n"); local hidden_commands = require "util.set".new{ "register", "unregister", "addplugin" }; - local commands_order = { "install", "remove", "list", "enabled_plugins", "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", + local commands_order = { "install", "remove", "list", "adduser", "passwd", "deluser", "start", "stop", "restart", "reload", "about" }; local done = {}; -- cgit v1.2.3 From ce4f9d56d998d47c6466a7ae2edd1149d88bd334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 16 Aug 2019 08:38:29 -0700 Subject: prosodyctl: Fixed a typo --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 9c94fea4..4c8892ac 100755 --- a/prosodyctl +++ b/prosodyctl @@ -96,7 +96,7 @@ end function commands.remove(arg) if arg[1] == "--help" then - show_usage([[remove]], [[Removes a module installed in the wroking directory's plugins folder]]); + show_usage([[remove]], [[Removes a module installed in the working directory's plugins folder]]); return 1; end table.insert(arg, "remove"); -- cgit v1.2.3 From 9d8380db119f65c4bb6d5ef5701c35e7b5722e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Duarte?= Date: Fri, 16 Aug 2019 14:58:29 -0700 Subject: prosodyctl: Install, remove and list commands now use the call_luarocks function --- prosodyctl | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 4c8892ac..664deb51 100755 --- a/prosodyctl +++ b/prosodyctl @@ -76,7 +76,7 @@ local show_usage = prosodyctl.show_usage; local show_yesno = prosodyctl.show_yesno; local show_prompt = prosodyctl.show_prompt; local read_password = prosodyctl.read_password; -local execute_command = prosodyctl.execute_command; +local call_luarocks = prosodyctl.call_luarocks; local jid_split = require "util.jid".prepped_split; @@ -90,8 +90,7 @@ function commands.install(arg) show_usage([[install]], [[Installs a prosody/luarocks plugin]]); return 1; end - table.insert(arg, "install"); - execute_command(arg); + call_luarocks(arg[1], "install") end function commands.remove(arg) @@ -99,8 +98,7 @@ function commands.remove(arg) show_usage([[remove]], [[Removes a module installed in the working directory's plugins folder]]); return 1; end - table.insert(arg, "remove"); - execute_command(arg); + call_luarocks(arg[1], "remove") end function commands.list(arg) @@ -108,8 +106,7 @@ function commands.list(arg) show_usage([[list]], [[Shows installed rocks]]); return 1; end - table.insert(arg, "list"); - execute_command(arg); + call_luarocks(arg[1], "list") end function commands.adduser(arg) -- cgit v1.2.3 From f6983a3d514a29fb8eab260f65373523450046cf Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 1 Nov 2019 23:16:58 +0100 Subject: prosodyctl: Print friendly version of error messages --- prosodyctl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosodyctl') diff --git a/prosodyctl b/prosodyctl index 82b5faaa..a4724a19 100755 --- a/prosodyctl +++ b/prosodyctl @@ -144,7 +144,7 @@ function commands.adduser(arg) if ok then return 0; end - show_message(msg) + show_message(error_messages[msg]) return 1; end -- cgit v1.2.3