diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-05-04 12:24:47 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-05-04 12:24:47 +0300 |
commit | cf53d834e9931151a46fed31e644d7eb05e816be (patch) | |
tree | 0c559620641e6225adb3c2e5c3848b85a72250bc /src/gen_iq_handler.erl | |
parent | Validate module options on start_module/2 (diff) |
Introduce 'iqdisc' global option
Diffstat (limited to 'src/gen_iq_handler.erl')
-rw-r--r-- | src/gen_iq_handler.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gen_iq_handler.erl b/src/gen_iq_handler.erl index ebf056eb..aaa7861d 100644 --- a/src/gen_iq_handler.erl +++ b/src/gen_iq_handler.erl @@ -31,11 +31,13 @@ -define(GEN_SERVER, gen_server). -endif. -behaviour(?GEN_SERVER). +-behaviour(ejabberd_config). %% API -export([start_link/3, add_iq_handler/6, remove_iq_handler/3, stop_iq_handler/3, handle/5, - process_iq/4, check_type/1, transform_module_options/1]). + process_iq/4, check_type/1, transform_module_options/1, + opt_type/1, iqdisc/1]). %% gen_server callbacks -export([init/1, handle_call/3, handle_cast/2, @@ -183,6 +185,9 @@ check_type(one_queue) -> one_queue; check_type(N) when is_integer(N), N>0 -> N; check_type(parallel) -> parallel. +iqdisc(Host) -> + ejabberd_config:get_option({iqdisc, Host}, one_queue). + -spec transform_module_options([{atom(), any()}]) -> [{atom(), any()}]. transform_module_options(Opts) -> @@ -193,6 +198,9 @@ transform_module_options(Opts) -> Opt end, Opts). +opt_type(iqdisc) -> fun check_type/1; +opt_type(_) -> [iqdisc]. + %%==================================================================== %% gen_server callbacks %%==================================================================== |