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),
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)]);
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