Skip to content

Commit

Permalink
mod_block_strangers: Bounce an error message
Browse files Browse the repository at this point in the history
Return a stanza error when a message is rejected, in order to make
legitimate users aware of the issue.

Closes processone#2197.
  • Loading branch information
weiss committed Jan 2, 2018
1 parent 1fcb6d7 commit 031232d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mod_block_strangers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ check_message(#message{from = From, to = To} = Msg) ->
if
Log ->
?INFO_MSG("~s message from stranger ~s to ~s",
[if Drop -> "Dropping";
[if Drop -> "Rejecting";
true -> "Allow"
end,
jid:encode(From), jid:encode(To)]);
Expand All @@ -104,6 +104,9 @@ check_message(#message{from = From, to = To} = Msg) ->
end,
if
Drop ->
Txt = <<"Messages from strangers are rejected">>,
Err = xmpp:err_policy_violation(Txt, ?MYLANG),
ejabberd_router:route_error(Msg, Err),
deny;
true ->
allow
Expand Down

0 comments on commit 031232d

Please sign in to comment.