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(
|
||||
fun(Command) ->
|
||||
%% 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])
|
||||
end,
|
||||
Commands),
|
||||
ejabberd_access_permissions:invalidate(),
|
||||
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.
|
||||
|
||||
unregister_commands(Commands) ->
|
||||
|
|
Loading…
Reference in New Issue