Software / code / prosody
Comparison
prosodyctl @ 10127:cb5e4e07ab11
Merge my line of development->trunk
| author | João Duarte <jvsDuarte08@gmail.com> |
|---|---|
| date | Fri, 21 Jun 2019 01:16:18 +0100 |
| parent | 10126:ad640c2e072e |
| child | 10128:026815f8d832 |
comparison
equal
deleted
inserted
replaced
| 10058:08c6540f5a65 | 10127:cb5e4e07ab11 |
|---|---|
| 82 | 82 |
| 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; | 83 local prosodyctl_timeout = (configmanager.get("*", "prosodyctl_timeout") or 5) * 2; |
| 84 ----------------------- | 84 ----------------------- |
| 85 local commands = {}; | 85 local commands = {}; |
| 86 local command = table.remove(arg, 1); | 86 local command = table.remove(arg, 1); |
| 87 | |
| 88 function commands.list(arg) | |
| 89 -- Need to think about the case with many flags | |
| 90 local flag="--tree=" | |
| 91 -- I'm considering the flag is the first, but there can be many flags | |
| 92 if arg[1] and arg[1]:sub(1, #flag) == flag then | |
| 93 local dir = arg[1]:match("=(.+)$") | |
| 94 -- These extra double brackets allow us to correctly process names with spaces | |
| 95 os.execute("luarocks list --tree=".."'"..dir.."'") | |
| 96 else | |
| 97 os.execute("luarocks list --tree="..prosody.paths.data.."/rocks") | |
| 98 end | |
| 99 end | |
| 100 | |
| 101 function commands.enabled_plugins() | |
| 102 for module in modulemanager.get_modules_for_host() do | |
| 103 show_warning("%s", module) | |
| 104 end | |
| 105 end | |
| 106 | |
| 107 function commands.local_plugins() | |
| 108 local directory = "./plugins" | |
| 109 local i, t, popen = 0, {}, io.popen | |
| 110 local pfile = popen('ls -a "'..directory..'"') | |
| 111 for filename in pfile:lines() do | |
| 112 if filename == "." or filename == ".." then | |
| 113 i = i + 1 | |
| 114 else | |
| 115 i = i + 1 | |
| 116 t[i] = filename | |
| 117 show_warning("%s", t[i]) | |
| 118 end | |
| 119 end | |
| 120 pfile:close() | |
| 121 end | |
| 87 | 122 |
| 88 function commands.adduser(arg) | 123 function commands.adduser(arg) |
| 89 if not arg[1] or arg[1] == "--help" then | 124 if not arg[1] or arg[1] == "--help" then |
| 90 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); | 125 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); |
| 91 return 1; | 126 return 1; |