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

start/stop_modules/methods accept atom or list of atoms

This commit is contained in:
Badlop 2011-06-22 12:32:52 +02:00
parent b2f06226b5
commit ef67ec4286
2 changed files with 18 additions and 14 deletions

View File

@ -54,12 +54,10 @@
]). ]).
-export([start/1 -export([start/1
,start_module/2
,stop_module/2
,start_modules/2 ,start_modules/2
,start_method/2 ,stop_modules/2
,stop_method/2
,start_methods/2 ,start_methods/2
,stop_methods/2
]). ]).
-export([auth_modules/1]). -export([auth_modules/1]).
@ -84,18 +82,24 @@ start(Host) ->
start_modules(Host, auth_modules(Host)). start_modules(Host, auth_modules(Host)).
start_modules(Host, Modules) when is_list(Modules) -> start_modules(Host, Modules) when is_list(Modules) ->
lists:foreach(fun (M) -> start_module(Host, M) end, Modules). lists:foreach(fun (M) -> start_modules(Host, M) end, Modules);
start_module(Host, Module) when is_atom(Module) -> start_modules(Host, Module) when is_atom(Module) ->
Module:start(Host). Module:start(Host).
stop_module(Host, Module) when is_atom(Module) ->
stop_modules(Host, Modules) when is_list(Modules) ->
lists:foreach(fun (M) -> stop_modules(Host, M) end, Modules);
stop_modules(Host, Module) when is_atom(Module) ->
Module:stop(Host). Module:stop(Host).
start_methods(Host, Methods) when is_list(Methods) -> start_methods(Host, Methods) when is_list(Methods) ->
lists:foreach(fun (M) -> start_method(Host, M) end, Methods). lists:foreach(fun (M) -> start_methods(Host, M) end, Methods);
start_method(Host, Method) when is_atom(Method) -> start_methods(Host, Method) when is_atom(Method) ->
start_module(Host, module_name(Method)). start_modules(Host, module_name(Method)).
stop_method(Host, Method) when is_atom(Method) ->
stop_module(Host, module_name(Method)). stop_methods(Host, Methods) when is_list(Methods) ->
lists:foreach(fun (M) -> stop_methods(Host, M) end, Methods);
stop_methods(Host, Method) when is_atom(Method) ->
stop_modules(Host, module_name(Method)).
%% @spec (Server) -> bool() %% @spec (Server) -> bool()

View File

@ -351,7 +351,7 @@ start_host(Host) when is_list(Host) ->
end, end,
case auth_method(Host) of case auth_method(Host) of
{host_method, HostMethod} -> {host_method, HostMethod} ->
ejabberd_auth:start_method(Host, HostMethod) ejabberd_auth:start_methods(Host, HostMethod)
end, end,
ok. ok.
@ -371,7 +371,7 @@ stop_host(Host) when is_list(Host) ->
end, gen_mod:loaded_modules(Host)), end, gen_mod:loaded_modules(Host)),
case auth_method(Host) of case auth_method(Host) of
{host_method, Method} -> {host_method, Method} ->
ejabberd_auth:stop_method(Host, Method) ejabberd_auth:stop_methods(Host, Method)
end. end.
%% Get the current vhost list from a variety of sources (ODBC, internal) %% Get the current vhost list from a variety of sources (ODBC, internal)