diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-29 11:39:40 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-29 11:39:40 +0300 |
commit | b82b93f8f0c229e94a89469b0754bab0e28cd17c (patch) | |
tree | 56f5c7a25aa19254b4f30b1cf33fc34dcbadcbb7 /src/mod_register.erl | |
parent | Don't re-define validation functions in multiple places (diff) |
Don't validate an option in ejabberd_config:get_option() functions
The commit introduces the following changes:
* Now there is no need to pass validating function in
ejabberd_config:get_option() functions, because the configuration
keeps already validated values.
* New function ejabberd_config:get_option/1 is introduced
* Function ejabberd_config:get_option/3 is deprecated. If the function
is still called, the second argument (validating function) is simply
ignored.
* The second argument for ejabberd_config:get_option/2 is now
a default value, not a validating function.
Diffstat (limited to 'src/mod_register.erl')
-rw-r--r-- | src/mod_register.erl | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/src/mod_register.erl b/src/mod_register.erl index e15165f7..63f7708b 100644 --- a/src/mod_register.erl +++ b/src/mod_register.erl @@ -435,15 +435,7 @@ check_from(JID, Server) -> check_timeout(undefined) -> true; check_timeout(Source) -> - Timeout = ejabberd_config:get_option( - registration_timeout, - fun(TO) when is_integer(TO), TO > 0 -> - TO; - (infinity) -> - infinity; - (unlimited) -> - infinity - end, 600), + Timeout = ejabberd_config:get_option(registration_timeout, 600), if is_integer(Timeout) -> Priority = -p1_time_compat:system_time(seconds), CleanPriority = Priority + Timeout, @@ -488,15 +480,7 @@ clean_treap(Treap, CleanPriority) -> remove_timeout(undefined) -> true; remove_timeout(Source) -> - Timeout = ejabberd_config:get_option( - registration_timeout, - fun(TO) when is_integer(TO), TO > 0 -> - TO; - (infinity) -> - infinity; - (unlimited) -> - infinity - end, 600), + Timeout = ejabberd_config:get_option(registration_timeout, 600), if is_integer(Timeout) -> F = fun () -> Treap = case mnesia:read(mod_register_ip, treap, write) |