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

Added clause so ejabberdctl number of arguments error report works with R15

This commit is contained in:
Badlop 2012-08-27 16:38:52 +02:00
parent a47fd96cc8
commit 4147081f0b

View File

@ -292,7 +292,18 @@ call_command([CmdString | Args], Auth, AccessCommands) ->
Result = ejabberd_commands:execute_command(AccessCommands, Auth, Command, Result = ejabberd_commands:execute_command(AccessCommands, Auth, Command,
ArgsFormatted), ArgsFormatted),
format_result(Result, ResultFormat); format_result(Result, ResultFormat);
%% This case clause is for Erlang R14 and older
{'EXIT', {function_clause,[{lists,zip,[A1, A2]} | _]}} -> {'EXIT', {function_clause,[{lists,zip,[A1, A2]} | _]}} ->
{NumCompa, TextCompa} =
case {length(A1), length(A2)} of
{L1, L2} when L1 < L2 -> {L2-L1, "less argument"};
{L1, L2} when L1 > L2 -> {L1-L2, "more argument"}
end,
{io_lib:format("Error: the command ~p requires ~p ~s.",
[CmdString, NumCompa, TextCompa]),
wrong_command_arguments};
%% This case clause is for Erlang R15 and newer
{'EXIT', {function_clause,[{lists,zip,[A1, A2],_} | _]}} ->
{NumCompa, TextCompa} = {NumCompa, TextCompa} =
case {length(A1), length(A2)} of case {length(A1), length(A2)} of
{L1, L2} when L1 < L2 -> {L2-L1, "less argument"}; {L1, L2} when L1 < L2 -> {L2-L1, "less argument"};