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/acl.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/acl.erl')
-rw-r--r-- | src/acl.erl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/acl.erl b/src/acl.erl index 0cdd7daa6..3e0617f55 100644 --- a/src/acl.erl +++ b/src/acl.erl @@ -199,13 +199,13 @@ load_from_config() -> lists:foreach( fun(Host) -> ACLs = ejabberd_config:get_option( - {acl, Host}, fun(V) -> V end, []), + {acl, Host}, []), AccessRules = ejabberd_config:get_option( - {access, Host}, fun(V) -> V end, []), + {access, Host}, []), AccessRulesNew = ejabberd_config:get_option( - {access_rules, Host}, fun(V) -> V end, []), + {access_rules, Host}, []), ShaperRules = ejabberd_config:get_option( - {shaper_rules, Host}, fun(V) -> V end, []), + {shaper_rules, Host}, []), lists:foreach( fun({ACLName, SpecList}) -> lists:foreach( @@ -605,7 +605,7 @@ access_rules_validator(Rules0) -> (deny) -> true; (_) -> false end), - throw({replace_with, Rules}). + Rules. shaper_rules_validator(Name) when is_atom(Name) -> @@ -616,7 +616,7 @@ shaper_rules_validator(Rules0) -> (V2) when is_integer(V2) -> true; (_) -> false end), - throw({replace_with, Rules}). + Rules. access_shaper_rules_validator([{Type, Acls} = Rule | Rest], RuleTypeCheck) -> case RuleTypeCheck(Type) of |