mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-30 16:36:29 +01:00
avoid node_call to break transaction (thanks to Karim Gemayel)(EJAB-1286)
This commit is contained in:
parent
01b6cd3aba
commit
5e0f2b8560
@ -308,12 +308,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) ->
|
Plugins_OK = lists:foldl(fun(Name, Acc) ->
|
||||||
?DEBUG("** init ~s plugin",[Name]),
|
Plugin = list_to_atom(?PLUGIN_PREFIX ++ Name),
|
||||||
Plugin = list_to_atom(?PLUGIN_PREFIX ++ Name),
|
case catch apply(Plugin, init, [Host, ServerHost, Opts]) of
|
||||||
Plugin:init(Host, ServerHost, Opts)
|
{'EXIT', _Error} ->
|
||||||
end, Plugins),
|
Acc;
|
||||||
{Plugins, TreePlugin, PepMapping}.
|
_ ->
|
||||||
|
?DEBUG("** init ~s plugin",[Name]),
|
||||||
|
[Name | Acc]
|
||||||
|
end
|
||||||
|
end, [], Plugins),
|
||||||
|
{Plugins_OK, TreePlugin, PepMapping}.
|
||||||
|
|
||||||
|
|
||||||
-spec(terminate_plugins/4 ::
|
-spec(terminate_plugins/4 ::
|
||||||
@ -4362,7 +4367,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}} ->
|
||||||
|
Loading…
Reference in New Issue
Block a user