25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +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
,start_module/2
,stop_module/2
,start_modules/2
,start_method/2
,stop_method/2
,stop_modules/2
,start_methods/2
,stop_methods/2
]).
-export([auth_modules/1]).
@ -84,18 +82,24 @@ start(Host) ->
start_modules(Host, auth_modules(Host)).
start_modules(Host, Modules) when is_list(Modules) ->
lists:foreach(fun (M) -> start_module(Host, M) end, Modules).
start_module(Host, Module) when is_atom(Module) ->
lists:foreach(fun (M) -> start_modules(Host, M) end, Modules);
start_modules(Host, Module) when is_atom(Module) ->
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).
start_methods(Host, Methods) when is_list(Methods) ->
lists:foreach(fun (M) -> start_method(Host, M) end, Methods).
start_method(Host, Method) when is_atom(Method) ->
start_module(Host, module_name(Method)).
stop_method(Host, Method) when is_atom(Method) ->
stop_module(Host, module_name(Method)).
lists:foreach(fun (M) -> start_methods(Host, M) end, Methods);
start_methods(Host, Method) when is_atom(Method) ->
start_modules(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()

View File

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