mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-18 22:15:20 +02:00
ejabberd_commands: Add the command version as a tag "vX"
This commit is contained in:
parent
1326a7764a
commit
98d7519274
|
@ -147,13 +147,25 @@ register_commands(Definer, Commands) ->
|
||||||
lists:foreach(
|
lists:foreach(
|
||||||
fun(Command) ->
|
fun(Command) ->
|
||||||
%% XXX check if command exists
|
%% XXX check if command exists
|
||||||
mnesia:dirty_write(Command#ejabberd_commands{definer = Definer})
|
mnesia:dirty_write(register_command_prepare(Command, Definer))
|
||||||
%% ?DEBUG("This command is already defined:~n~p", [Command])
|
%% ?DEBUG("This command is already defined:~n~p", [Command])
|
||||||
end,
|
end,
|
||||||
Commands),
|
Commands),
|
||||||
ejabberd_access_permissions:invalidate(),
|
ejabberd_access_permissions:invalidate(),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
register_command_prepare(Command, Definer) ->
|
||||||
|
Tags1 = Command#ejabberd_commands.tags,
|
||||||
|
Tags2 = case Command#ejabberd_commands.version of
|
||||||
|
0 -> Tags1;
|
||||||
|
Version -> Tags1 ++ [list_to_atom("v"++integer_to_list(Version))]
|
||||||
|
end,
|
||||||
|
Command#ejabberd_commands{definer = Definer, tags = Tags2}.
|
||||||
|
|
||||||
|
|
||||||
-spec unregister_commands([ejabberd_commands()]) -> ok.
|
-spec unregister_commands([ejabberd_commands()]) -> ok.
|
||||||
|
|
||||||
unregister_commands(Commands) ->
|
unregister_commands(Commands) ->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user