diff options
Diffstat (limited to 'src/ejabberd_commands.erl')
-rw-r--r-- | src/ejabberd_commands.erl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index fd8ba03fe..dd14748d0 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -218,6 +218,7 @@ get_command_format/1, get_command_format/2, get_command_format/3, + get_command_policy/1, get_command_definition/1, get_command_definition/2, get_tags_commands/0, @@ -364,6 +365,17 @@ get_command_format(Name, Auth, Version) -> {Args, Result} end. +-spec get_command_policy(atom()) -> {ok, open|user|admin|restricted} | {error, command_not_found}. + +%% @doc return command policy. +get_command_policy(Name) -> + case get_command_definition(Name) of + #ejabberd_commands{policy = Policy} -> + {ok, Policy}; + command_not_found -> + {error, command_not_found} + end. + -spec get_command_definition(atom()) -> ejabberd_commands(). %% @doc Get the definition record of a command. |