aboutsummaryrefslogtreecommitdiff
path: root/src/gen_mod.erl
diff options
context:
space:
mode:
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>2014-07-08 20:57:43 +0400
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>2014-07-08 20:58:03 +0400
commitfc692ea5121f5c18d17d417233932fd4cdf2fdc2 (patch)
treee6f78b088195353c261d0490992e076ec8fc7b24 /src/gen_mod.erl
parentImprove documentation of mod_sip (diff)
Add start_module/2
Diffstat (limited to 'src/gen_mod.erl')
-rw-r--r--src/gen_mod.erl15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gen_mod.erl b/src/gen_mod.erl
index 261e6c6dd..6dac8cdef 100644
--- a/src/gen_mod.erl
+++ b/src/gen_mod.erl
@@ -28,7 +28,7 @@
-author('alexey@process-one.net').
--export([start/0, start_module/3, stop_module/2,
+-export([start/0, start_module/2, start_module/3, stop_module/2,
stop_module_keep_config/2, get_opt/3, get_opt/4,
get_opt_host/3, db_type/1, db_type/2, get_module_opt/5,
get_module_opt_host/3, loaded_modules/1,
@@ -60,6 +60,19 @@ start() ->
{keypos, #ejabberd_module.module_host}]),
ok.
+-spec start_module(binary(), atom()) -> any().
+
+start_module(Host, Module) ->
+ Modules = ejabberd_config:get_option(
+ {modules, Host},
+ fun(L) when is_list(L) -> L end, []),
+ case lists:keyfind(Module, 1, Modules) of
+ {_, Opts} ->
+ start_module(Host, Module, Opts);
+ false ->
+ {error, not_found_in_config}
+ end.
+
-spec start_module(binary(), atom(), opts()) -> any().
start_module(Host, Module, Opts) ->