24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-10 21:47:01 +02:00

avoid node_call to break transaction (thanks to Karim Gemayel)(EJAB-1286)

This commit is contained in:
Christophe Romain 2010-11-08 11:16:51 +01:00
parent c4bc0e7252
commit 917e8640c2

View File

@ -259,12 +259,17 @@ init_plugins(Host, ServerHost, Opts) ->
Plugins = gen_mod:get_opt(plugins, Opts, [?STDNODE]), Plugins = gen_mod:get_opt(plugins, Opts, [?STDNODE]),
PepMapping = gen_mod:get_opt(pep_mapping, Opts, []), PepMapping = gen_mod:get_opt(pep_mapping, Opts, []),
?DEBUG("** PEP Mapping : ~p~n",[PepMapping]), ?DEBUG("** PEP Mapping : ~p~n",[PepMapping]),
lists:foreach(fun(Name) -> PluginsOK = lists:foldl(fun(Name, Acc) ->
?DEBUG("** init ~s plugin",[Name]),
Plugin = list_to_atom(?PLUGIN_PREFIX ++ Name), Plugin = list_to_atom(?PLUGIN_PREFIX ++ Name),
Plugin:init(Host, ServerHost, Opts) case catch apply(Plugin, init, [Host, ServerHost, Opts]) of
end, Plugins), {'EXIT', _Error} ->
{Plugins, TreePlugin, PepMapping}. Acc;
_ ->
?DEBUG("** init ~s plugin",[Name]),
[Name | Acc]
end
end, [], Plugins),
{PluginsOK, TreePlugin, PepMapping}.
terminate_plugins(Host, ServerHost, Plugins, TreePlugin) -> terminate_plugins(Host, ServerHost, Plugins, TreePlugin) ->
lists:foreach(fun(Name) -> lists:foreach(fun(Name) ->
@ -3727,7 +3732,7 @@ tree_action(Host, Function, Args) ->
node_call(Type, Function, Args) -> node_call(Type, Function, Args) ->
?DEBUG("node_call ~p ~p ~p",[Type, Function, Args]), ?DEBUG("node_call ~p ~p ~p",[Type, Function, Args]),
Module = list_to_atom(?PLUGIN_PREFIX++Type), Module = list_to_atom(?PLUGIN_PREFIX++Type),
case catch apply(Module, Function, Args) of case apply(Module, Function, Args) of
{result, Result} -> {result, Result}; {result, Result} -> {result, Result};
{error, Error} -> {error, Error}; {error, Error} -> {error, Error};
{'EXIT', {undef, Undefined}} -> {'EXIT', {undef, Undefined}} ->