25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Merge pull request #2202 from weiss/bounce-to-stranger

mod_block_strangers: Bounce an error message
This commit is contained in:
Evgeny Khramtsov 2018-01-05 11:43:18 +03:00 committed by GitHub
commit 946754536c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -79,7 +79,7 @@ filter_offline_msg({_Action, #message{} = Msg} = Acc) ->
deny -> {stop, {drop, Msg}}
end.
check_message(#message{from = From, to = To} = Msg) ->
check_message(#message{from = From, to = To, lang = Lang} = Msg) ->
LServer = To#jid.lserver,
AllowLocalUsers =
gen_mod:get_module_opt(LServer, ?MODULE, allow_local_users, true),
@ -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)]);
@ -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, Lang),
ejabberd_router:route_error(Msg, Err),
deny;
true ->
allow