mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-12 21:52:07 +02:00
Avoid returning 'stopped' from ejabberd_hooks:run_fold()
This commit is contained in:
parent
f7ad25108c
commit
590849e2c3
|
@ -111,16 +111,16 @@ run(Hook, Host, Args) ->
|
||||||
ok
|
ok
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec run_fold(atom(), any(), list()) -> any().
|
-spec run_fold(atom(), T, list()) -> T.
|
||||||
%% @doc Run the calls of this hook in order.
|
%% @doc Run the calls of this hook in order.
|
||||||
%% The arguments passed to the function are: [Val | Args].
|
%% The arguments passed to the function are: [Val | Args].
|
||||||
%% The result of a call is used as Val for the next call.
|
%% The result of a call is used as Val for the next call.
|
||||||
%% If a call returns 'stop', no more calls are performed and 'stopped' is returned.
|
%% If a call returns 'stop', no more calls are performed.
|
||||||
%% If a call returns {stop, NewVal}, no more calls are performed and NewVal is returned.
|
%% If a call returns {stop, NewVal}, no more calls are performed and NewVal is returned.
|
||||||
run_fold(Hook, Val, Args) ->
|
run_fold(Hook, Val, Args) ->
|
||||||
run_fold(Hook, global, Val, Args).
|
run_fold(Hook, global, Val, Args).
|
||||||
|
|
||||||
-spec run_fold(atom(), binary() | global, any(), list()) -> any().
|
-spec run_fold(atom(), binary() | global, T, list()) -> T.
|
||||||
run_fold(Hook, Host, Val, Args) ->
|
run_fold(Hook, Host, Val, Args) ->
|
||||||
try ets:lookup(hooks, {Hook, Host}) of
|
try ets:lookup(hooks, {Hook, Host}) of
|
||||||
[{_, Ls}] ->
|
[{_, Ls}] ->
|
||||||
|
@ -210,7 +210,7 @@ run1([{_Seq, Module, Function} | Ls], Hook, Args) ->
|
||||||
run1(Ls, Hook, Args)
|
run1(Ls, Hook, Args)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec run_fold1([hook()], atom(), T, list()) -> T | stopped.
|
-spec run_fold1([hook()], atom(), T, list()) -> T.
|
||||||
run_fold1([], _Hook, Val, _Args) ->
|
run_fold1([], _Hook, Val, _Args) ->
|
||||||
Val;
|
Val;
|
||||||
run_fold1([{_Seq, Module, Function} | Ls], Hook, Val, Args) ->
|
run_fold1([{_Seq, Module, Function} | Ls], Hook, Val, Args) ->
|
||||||
|
@ -219,7 +219,7 @@ run_fold1([{_Seq, Module, Function} | Ls], Hook, Val, Args) ->
|
||||||
'EXIT' ->
|
'EXIT' ->
|
||||||
run_fold1(Ls, Hook, Val, Args);
|
run_fold1(Ls, Hook, Val, Args);
|
||||||
stop ->
|
stop ->
|
||||||
stopped;
|
Val;
|
||||||
{stop, NewVal} ->
|
{stop, NewVal} ->
|
||||||
NewVal;
|
NewVal;
|
||||||
NewVal ->
|
NewVal ->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user