diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2015-05-31 16:14:57 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2015-06-01 15:22:31 +0300 |
commit | a9f7d9481f778e982c3f20ef82e41d66c6179f1c (patch) | |
tree | 5ac3c1aa7668cc993f73acec8096b44f760ccce6 /src/gen_mod.erl | |
parent | Reorganize get_opt() code in some modules (diff) |
Do not try to fetch module options via eldap_utils
Diffstat (limited to '')
-rw-r--r-- | src/gen_mod.erl | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gen_mod.erl b/src/gen_mod.erl index b8e155a0..29d5dfb7 100644 --- a/src/gen_mod.erl +++ b/src/gen_mod.erl @@ -155,13 +155,20 @@ wait_for_stop1(MonitorReference) -> -type check_fun() :: fun((any()) -> any()) | {module(), atom()}. --spec get_opt(atom(), opts(), check_fun()) -> any(). +-spec get_opt(atom() | {atom(), binary()|global}, opts(), check_fun()) -> any(). get_opt(Opt, Opts, F) -> get_opt(Opt, Opts, F, undefined). --spec get_opt(atom(), opts(), check_fun(), any()) -> any(). +-spec get_opt(atom() | {atom(), binary()|global}, opts(), check_fun(), any()) -> any(). +get_opt({Opt, Host}, Opts, F, Default) -> + case lists:keysearch(Opt, 1, Opts) of + false -> + ejabberd_config:get_option({Opt, Host}, F, Default); + {value, {_, Val}} -> + ejabberd_config:prepare_opt_val(Opt, Val, F, Default) + end; get_opt(Opt, Opts, F, Default) -> case lists:keysearch(Opt, 1, Opts) of false -> |