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:
commit
946754536c
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user