25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Describe commands arguments and results in ejabberd_sm, ext_mod, mod_mam

This commit is contained in:
Badlop 2017-07-21 11:18:44 +02:00
parent 250876ea1a
commit 1a0db3de3a
3 changed files with 40 additions and 22 deletions

View File

@ -957,30 +957,36 @@ cache_nodes(Mod, LServer) ->
%%% ejabberd commands
get_commands_spec() ->
[#ejabberd_commands{name = connected_users,
tags = [session],
[#ejabberd_commands{name = connected_users, tags = [session],
desc = "List all established sessions",
policy = admin,
module = ?MODULE, function = connected_users, args = [],
result_desc = "List of users sessions",
result_example = [<<"user1@example.com">>, <<"user2@example.com">>],
result = {connected_users, {list, {sessions, string}}}},
#ejabberd_commands{name = connected_users_number,
tags = [session, stats],
#ejabberd_commands{name = connected_users_number, tags = [session, stats],
desc = "Get the number of established sessions",
policy = admin,
module = ?MODULE, function = connected_users_number,
result_example = 2,
args = [], result = {num_sessions, integer}},
#ejabberd_commands{name = user_resources,
tags = [session],
#ejabberd_commands{name = user_resources, tags = [session],
desc = "List user's connected resources",
policy = user,
module = ?MODULE, function = user_resources,
args = [],
args_desc = ["User name", "Server name"],
args_example = [<<"user1">>, <<"example.com">>],
result_example = [<<"tka1">>, <<"Gajim">>, <<"mobile-app">>],
result = {resources, {list, {resource, string}}}},
#ejabberd_commands{name = kick_user,
tags = [session],
#ejabberd_commands{name = kick_user, tags = [session],
desc = "Disconnect user's active sessions",
module = ?MODULE, function = kick_user,
args = [{user, binary}, {host, binary}],
args_desc = ["User name", "Server name"],
args_example = [<<"user1">>, <<"example.com">>],
result_desc = "Number of resources that were kicked",
result_example = 3,
result = {num_resources, integer}}].
-spec connected_users() -> [binary()].

View File

@ -80,16 +80,18 @@ code_change(_OldVsn, State, _Extra) ->
get_commands_spec() ->
[#ejabberd_commands{name = modules_update_specs,
tags = [admin,modules],
desc = "",
longdesc = "",
desc = "Update the module source code from Git",
longdesc = "A connection to Internet is required",
module = ?MODULE, function = update,
args = [],
result = {res, rescode}},
#ejabberd_commands{name = modules_available,
tags = [admin,modules],
desc = "",
longdesc = "",
desc = "List the contributed modules available to install",
module = ?MODULE, function = available_command,
result_desc = "List of tuples with module name and description",
result_example = [{mod_cron, "Execute scheduled commands"},
{mod_rest, "ReST frontend"}],
args = [],
result = {modules, {list,
{module, {tuple,
@ -97,9 +99,11 @@ get_commands_spec() ->
{summary, string}]}}}}},
#ejabberd_commands{name = modules_installed,
tags = [admin,modules],
desc = "",
longdesc = "",
desc = "List the contributed modules already installed",
module = ?MODULE, function = installed_command,
result_desc = "List of tuples with module name and description",
result_example = [{mod_cron, "Execute scheduled commands"},
{mod_rest, "ReST frontend"}],
args = [],
result = {modules, {list,
{module, {tuple,
@ -107,30 +111,35 @@ get_commands_spec() ->
{summary, string}]}}}}},
#ejabberd_commands{name = module_install,
tags = [admin,modules],
desc = "",
longdesc = "",
desc = "Compile, install and start an available contributed module",
module = ?MODULE, function = install,
args_desc = "Module name",
args_example = mod_rest,
args = [{module, binary}],
result = {res, rescode}},
#ejabberd_commands{name = module_uninstall,
tags = [admin,modules],
desc = "",
longdesc = "",
desc = "Uninstall a contributed module",
module = ?MODULE, function = uninstall,
args_desc = "Module name",
args_example = mod_rest,
args = [{module, binary}],
result = {res, rescode}},
#ejabberd_commands{name = module_upgrade,
tags = [admin,modules],
desc = "",
longdesc = "",
desc = "Upgrade the running code of an installed module",
longdesc = "In practice, this uninstalls and installs the module",
module = ?MODULE, function = upgrade,
args_desc = "Module name",
args_example = mod_rest,
args = [{module, binary}],
result = {res, rescode}},
#ejabberd_commands{name = module_check,
tags = [admin,modules],
desc = "",
longdesc = "",
desc = "Check the contributed module repository compliance",
module = ?MODULE, function = check,
args_desc = "Module name",
args_example = mod_rest,
args = [{module, binary}],
result = {res, rescode}}
].

View File

@ -1008,6 +1008,9 @@ get_commands_spec() ->
longdesc = "Valid message TYPEs: "
"\"chat\", \"groupchat\", \"all\".",
module = ?MODULE, function = delete_old_messages,
args_desc = ["Type of messages to delete (chat, groupchat, all)",
"Days to keep messages"],
args_example = [<<"all">>, 31],
args = [{type, binary}, {days, integer}],
result = {res, rescode}}].