]> granicus.if.org Git - ejabberd/commitdiff
start/stop_modules/methods accept atom or list of atoms
authorBadlop <badlop@process-one.net>
Wed, 22 Jun 2011 10:32:52 +0000 (12:32 +0200)
committerBadlop <badlop@process-one.net>
Wed, 22 Jun 2011 10:32:52 +0000 (12:32 +0200)
src/ejabberd_auth.erl
src/ejabberd_hosts.erl

index 738976c775aab2f43bbcb098f2a18319672f29b5..38876302e7cc94466aac27aba164342d7f5f358c 100644 (file)
        ]).
 
 -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()
index a8990a515320ee6dd56105132ac2bf0185b03bd0..ebdc2c4c50827dfad968a4677677ed2328f16db9 100644 (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)