From ccb4328d06bd39a10c2ecc109a6647cf1eafdaa9 Mon Sep 17 00:00:00 2001 From: Badlop Date: Thu, 29 Jul 2021 23:13:17 +0200 Subject: Store who defines a command, specially when defined by ejabberd modules --- src/ejabberd_commands.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ejabberd_commands.erl') diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index 0f86f23d3..8d875e82f 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -41,6 +41,7 @@ get_tags_commands/0, get_tags_commands/1, register_commands/1, + register_commands/2, unregister_commands/1, get_commands_spec/0, get_commands_definition/0, @@ -129,10 +130,13 @@ code_change(_OldVsn, State, _Extra) -> -spec register_commands([ejabberd_commands()]) -> ok. register_commands(Commands) -> + register_commands(unknown, Commands). + +register_commands(Definer, Commands) -> lists:foreach( fun(Command) -> %% XXX check if command exists - mnesia:dirty_write(Command) + mnesia:dirty_write(Command#ejabberd_commands{definer = Definer}) %% ?DEBUG("This command is already defined:~n~p", [Command]) end, Commands), -- cgit v1.2.3 From 655dcbcb7467db3cb0f89cf99d34cc2244e6c84f Mon Sep 17 00:00:00 2001 From: Badlop Date: Sat, 21 Aug 2021 20:50:02 +0200 Subject: New command to produce markdown with tags and their associated commands --- src/ejabberd_commands.erl | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ejabberd_commands.erl') diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index 8d875e82f..c00b1469a 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -91,6 +91,16 @@ get_commands_spec() -> "that will have example invocation include in markdown document"], result_desc = "0 if command failed, 1 when succeeded", args_example = ["/home/me/docs/api.html", "mod_admin", "java,json"], + result_example = ok}, + #ejabberd_commands{name = gen_markdown_doc_for_tags, tags = [documentation], + desc = "Generates markdown documentation for ejabberd_commands", + module = ejabberd_commands_doc, function = generate_tags_md, + args = [{file, binary}], + result = {res, rescode}, + args_desc = ["Path to file where generated " + "documentation should be stored"], + result_desc = "0 if command failed, 1 when succeeded", + args_example = ["/home/me/docs/tags.md"], result_example = ok}]. start_link() -> -- cgit v1.2.3