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

Correct option validation

This commit is contained in:
Evgeniy Khramtsov 2017-04-20 18:55:16 +03:00
parent 264a40f217
commit 5444475b1d
2 changed files with 11 additions and 7 deletions

View File

@ -537,7 +537,9 @@ import_next(LServer, DBType, NodePair) ->
import_next(LServer, DBType, ets:next(caps_features_tmp, NodePair)).
mod_opt_type(O) when O == cache_life_time; O == cache_size ->
fun (I) when is_integer(I), I > 0 -> I end;
fun (I) when is_integer(I), I > 0 -> I;
(infinity) -> infinity
end;
mod_opt_type(O) when O == use_cache; O == cache_missed ->
fun (B) when is_boolean(B) -> B end;
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;

View File

@ -1041,10 +1041,12 @@ get_commands_spec() ->
mod_opt_type(assume_mam_usage) ->
fun (B) when is_boolean(B) -> B end;
mod_opt_type(cache_life_time) ->
fun (I) when is_integer(I), I > 0 -> I end;
mod_opt_type(cache_size) ->
fun (I) when is_integer(I), I > 0 -> I end;
mod_opt_type(O) when O == cache_life_time; O == cache_size ->
fun (I) when is_integer(I), I > 0 -> I;
(infinity) -> infinity
end;
mod_opt_type(O) when O == use_cache; O == cache_missed ->
fun (B) when is_boolean(B) -> B end;
mod_opt_type(db_type) -> fun(T) -> ejabberd_config:v_db(?MODULE, T) end;
mod_opt_type(default) ->
fun (always) -> always;
@ -1055,5 +1057,5 @@ mod_opt_type(iqdisc) -> fun gen_iq_handler:check_type/1;
mod_opt_type(request_activates_archiving) ->
fun (B) when is_boolean(B) -> B end;
mod_opt_type(_) ->
[assume_mam_usage, cache_life_time, cache_size, db_type, default, iqdisc,
request_activates_archiving].
[assume_mam_usage, cache_life_time, cache_size, use_cache, cache_missed,
db_type, default, iqdisc, request_activates_archiving].