diff options
Diffstat (limited to 'src/gen_iq_handler.erl')
-rw-r--r-- | src/gen_iq_handler.erl | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/gen_iq_handler.erl b/src/gen_iq_handler.erl index d53971fe4..628c1c90c 100644 --- a/src/gen_iq_handler.erl +++ b/src/gen_iq_handler.erl @@ -33,7 +33,7 @@ %% API -export([start_link/3, add_iq_handler/6, remove_iq_handler/3, stop_iq_handler/3, handle/7, - process_iq/6, check_type/1]). + process_iq/6, check_type/1, transform_module_options/1]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, @@ -46,7 +46,7 @@ -record(state, {host, module, function}). -type component() :: ejabberd_sm | ejabberd_local. --type type() :: no_queue | one_queue | {queues, pos_integer()} | parallel. +-type type() :: no_queue | one_queue | pos_integer() | parallel. -type opts() :: no_queue | {one_queue, pid()} | {queues, [pid()]} | parallel. %%==================================================================== @@ -71,7 +71,7 @@ add_iq_handler(Component, Host, NS, Module, Function, [Host, Module, Function]), Component:register_iq_handler(Host, NS, Module, Function, {one_queue, Pid}); - {queues, N} -> + N when is_integer(N) -> Pids = lists:map(fun (_) -> {ok, Pid} = supervisor:start_child(ejabberd_iq_sup, @@ -130,9 +130,19 @@ process_iq(_Host, Module, Function, From, To, IQ) -> check_type(no_queue) -> no_queue; check_type(one_queue) -> one_queue; -check_type({queues, N}) when is_integer(N), N>0 -> {queues, N}; +check_type(N) when is_integer(N), N>0 -> N; check_type(parallel) -> parallel. +-spec transform_module_options([{atom(), any()}]) -> [{atom(), any()}]. + +transform_module_options(Opts) -> + lists:map( + fun({iqdisc, {queues, N}}) -> + {iqdisc, N}; + (Opt) -> + Opt + end, Opts). + %%==================================================================== %% gen_server callbacks %%==================================================================== |