Skip to content

Commit

Permalink
mod_spam_filter: Stop hooks when dropping stanza
Browse files Browse the repository at this point in the history
  • Loading branch information
weiss committed Jun 17, 2024
1 parent 7517a4f commit d1812d4
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions mod_spam_filter/src/mod_spam_filter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -286,12 +286,11 @@ code_change(_OldVsn, #state{host = Host} = State, _Extra) ->
%% Hook callbacks.
%%--------------------------------------------------------------------
-spec s2s_receive_packet({stanza() | drop, s2s_in_state()})
-> {stanza() | drop, s2s_in_state()}.
-> {stanza() | drop | {stop, drop}, s2s_in_state()}.
s2s_receive_packet({A, State}) ->
{sm_receive_packet(A), State}.

-spec sm_receive_packet(stanza() | drop)
-> stanza() | stop.
-spec sm_receive_packet(stanza() | drop) -> stanza() | drop | {stop, drop}.
sm_receive_packet(drop = Acc) ->
Acc;
sm_receive_packet(#message{from = From,
Expand All @@ -308,11 +307,11 @@ sm_receive_packet(#message{from = From,
Acc;
spam ->
reject(Msg),
drop
{stop, drop}
end;
spam ->
reject(Msg),
drop
{stop, drop}
end;
false ->
Acc
Expand All @@ -327,7 +326,7 @@ sm_receive_packet(#presence{from = From,
Acc;
spam ->
reject(Presence),
drop
{stop, drop}
end;
false ->
Acc
Expand Down

0 comments on commit d1812d4

Please sign in to comment.