diff options
Diffstat (limited to 'src/gen_mod.erl')
-rw-r--r-- | src/gen_mod.erl | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gen_mod.erl b/src/gen_mod.erl index 5bfa3b4d4..e17197dfb 100644 --- a/src/gen_mod.erl +++ b/src/gen_mod.erl @@ -34,7 +34,8 @@ stop_child/1, stop_child/2, config_reloaded/0]). -export([start_module/2, start_module/3, stop_module/2, stop_module_keep_config/2, - get_opt/2, get_opt/3, get_opt_host/3, opt_type/1, is_equal_opt/4, + get_opt/2, get_opt/3, get_opt_host/3, + get_opt_hosts/3, opt_type/1, is_equal_opt/4, get_module_opt/3, get_module_opt/4, get_module_opt_host/3, loaded_modules/1, loaded_modules_with_opts/1, get_hosts/2, get_module_proc/2, is_loaded/2, is_loaded_elsewhere/2, @@ -441,6 +442,20 @@ get_opt_host(Host, Opts, Default) -> Val = get_opt(host, Opts, Default), ejabberd_regexp:greplace(Val, <<"@HOST@">>, Host). +-spec get_opt_hosts(binary(), opts(), binary()) -> [binary()]. + +get_opt_hosts(Host, Opts, Default) -> + Vals = case get_opt(host, Opts, undefined) of + undefined -> + case get_opt(hosts, Opts, []) of + [] -> [Default]; + L -> L + end; + Val -> + [Val] + end, + [ejabberd_regexp:greplace(V, <<"@HOST@">>, Host) || V <- Vals]. + -spec get_validators(binary(), module(), opts()) -> dict:dict() | undef. get_validators(Host, Module, Opts) -> try Module:mod_opt_type('') of |