mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-05 14:51:05 +02:00
* src/gen_mod.erl: Update in database the configuration changes in
modules (EJAB-330) SVN Revision: 996
This commit is contained in:
parent
eb330ac0e0
commit
69b425aeb7
@ -1,5 +1,8 @@
|
||||
2007-11-27 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/gen_mod.erl: Update in database the configuration changes in
|
||||
modules (EJAB-330)
|
||||
|
||||
* src/mod_configure.erl: The command get-user-lastlogin is now
|
||||
compatible with both Mnesia and ODBC (EJAB-383)
|
||||
* src/mod_last.erl: Likewise
|
||||
|
@ -46,6 +46,7 @@ start_module(Host, Module, Opts) ->
|
||||
{'EXIT', Reason} ->
|
||||
?ERROR_MSG("~p", [Reason]);
|
||||
_ ->
|
||||
set_module_opts_mnesia(Host, Module, Opts),
|
||||
ets:insert(ejabberd_modules,
|
||||
#ejabberd_module{module_host = {Module, Host},
|
||||
opts = Opts}),
|
||||
@ -58,13 +59,16 @@ stop_module(Host, Module) ->
|
||||
?ERROR_MSG("~p", [Reason]);
|
||||
{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.
|
||||
@ -154,6 +158,27 @@ loaded_modules_with_opts(Host) ->
|
||||
[],
|
||||
[{{'$1', '$2'}}]}]).
|
||||
|
||||
set_module_opts_mnesia(Host, Module, Opts) ->
|
||||
Modules = case ejabberd_config:get_local_option({modules, Host}) of
|
||||
undefined ->
|
||||
[];
|
||||
Ls ->
|
||||
Ls
|
||||
end,
|
||||
Modules1 = lists:keydelete(Module, 1, Modules),
|
||||
Modules2 = [{Module, Opts} | Modules1],
|
||||
ejabberd_config:add_local_option({modules, Host}, Modules2).
|
||||
|
||||
del_module_mnesia(Host, Module) ->
|
||||
Modules = case ejabberd_config:get_local_option({modules, Host}) of
|
||||
undefined ->
|
||||
[];
|
||||
Ls ->
|
||||
Ls
|
||||
end,
|
||||
Modules1 = lists:keydelete(Module, 1, Modules),
|
||||
ejabberd_config:add_local_option({modules, Host}, Modules1).
|
||||
|
||||
get_hosts(Opts, Prefix) ->
|
||||
case catch gen_mod:get_opt(hosts, Opts) of
|
||||
{'EXIT', _Error1} ->
|
||||
|
Loading…
Reference in New Issue
Block a user