+2008-07-30 Badlop <badlop@process-one.net>
+
+ * src/gen_mod.erl: When ejabberd is kindly stopped, don't forget
+ modules configuration (EJAB-706)
+ * src/ejabberd_app.erl: Likewise
+
2008-07-28 Badlop <badlop@process-one.net>
* doc/guide.tex: Document how to get error message when ejabberd
ok
end.
+%% @doc Stop the module in a host, and forget its configuration.
stop_module(Host, Module) ->
+ case stop_module_keep_config(Host, Module) of
+ error ->
+ error;
+ ok ->
+ del_module_mnesia(Host, Module)
+ end.
+
+%% @doc Stop the module in a host, but keep its configuration.
+%% As the module configuration is kept in the Mnesia local_config table,
+%% when ejabberd is restarted the module will be started again.
+%% This function is useful when ejabberd is being stopped
+%% and it stops all modules.
+stop_module_keep_config(Host, Module) ->
case catch Module:stop(Host) of
{'EXIT', Reason} ->
- ?ERROR_MSG("~p", [Reason]);
+ ?ERROR_MSG("~p", [Reason]),
+ error;
{wait, ProcList} when is_list(ProcList) ->
lists:foreach(fun wait_for_process/1, ProcList),
- del_module_mnesia(Host, Module),
ets:delete(ejabberd_modules, {Module, Host}),
ok;
{wait, Process} ->
wait_for_process(Process),
- del_module_mnesia(Host, Module),
ets:delete(ejabberd_modules, {Module, Host}),
ok;
_ ->
- del_module_mnesia(Host, Module),
ets:delete(ejabberd_modules, {Module, Host}),
ok
end.