mirror of
https://github.com/processone/ejabberd
synced 2025-10-06 03:50:15 +02:00
Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit: * Now there is no need to pass validating function in gen_mod:get_opt() and gen_mod:get_module_opt() functions, because the modules' configuration keeps already validated values. * New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are introduced. * Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated. If the functions are still called, the "function" argument is simply ignored. * Validating callback Mod:listen_opt_type/1 is introduced to validate listening options at startup.
This commit is contained in:
parent
2b63d07329
commit
fddd6110e0
67 changed files with 809 additions and 1238 deletions
|
@ -46,8 +46,7 @@
|
|||
-type block_event() :: {block, [jid()]} | {unblock, [jid()]} | unblock_all.
|
||||
|
||||
start(Host, Opts) ->
|
||||
IQDisc = gen_mod:get_opt(iqdisc, Opts, fun gen_iq_handler:check_type/1,
|
||||
one_queue),
|
||||
IQDisc = gen_mod:get_opt(iqdisc, Opts, one_queue),
|
||||
ejabberd_hooks:add(disco_local_features, Host, ?MODULE, disco_features, 50),
|
||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host,
|
||||
?NS_BLOCKING, ?MODULE, process_iq, IQDisc).
|
||||
|
@ -57,9 +56,7 @@ stop(Host) ->
|
|||
gen_iq_handler:remove_iq_handler(ejabberd_sm, Host, ?NS_BLOCKING).
|
||||
|
||||
reload(Host, NewOpts, OldOpts) ->
|
||||
case gen_mod:is_equal_opt(iqdisc, NewOpts, OldOpts,
|
||||
fun gen_iq_handler:check_type/1,
|
||||
one_queue) of
|
||||
case gen_mod:is_equal_opt(iqdisc, NewOpts, OldOpts, one_queue) of
|
||||
{false, IQDisc, _} ->
|
||||
gen_iq_handler:add_iq_handler(ejabberd_sm, Host, ?NS_BLOCKING,
|
||||
?MODULE, process_iq, IQDisc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue