mod_spam_filter: Also log spam recipient

Also log the recipient of rejected stanzas, not just the sender.
This commit is contained in:
Holger Weiss 2019-04-10 01:12:20 +02:00
parent 6a877d7018
commit e6249c41e2
1 changed files with 6 additions and 4 deletions

View File

@ -480,15 +480,17 @@ trim(S) ->
re:replace(S, <<"\\s+$">>, <<>>, [{return, binary}]). re:replace(S, <<"\\s+$">>, <<>>, [{return, binary}]).
-spec reject(stanza()) -> ok. -spec reject(stanza()) -> ok.
reject(#message{from = From, type = Type, lang = Lang} = Msg) reject(#message{from = From, to = To, type = Type, lang = Lang} = Msg)
when Type /= groupchat, when Type /= groupchat,
Type /= error -> Type /= error ->
?INFO_MSG("Rejecting unsolicited message from ~s", [jid:encode(From)]), ?INFO_MSG("Rejecting unsolicited message from ~s to ~s",
[jid:encode(From), jid:encode(To)]),
Txt = <<"Your traffic is unsolicited">>, Txt = <<"Your traffic is unsolicited">>,
Err = xmpp:err_policy_violation(Txt, Lang), Err = xmpp:err_policy_violation(Txt, Lang),
ejabberd_router:route_error(Msg, Err); ejabberd_router:route_error(Msg, Err);
reject(#presence{from = From}) -> reject(#presence{from = From, to = To}) ->
?INFO_MSG("Rejecting unsolicited presence from ~s", [jid:encode(From)]); ?INFO_MSG("Rejecting unsolicited presence from ~s to ~s",
[jid:encode(From), jid:encode(To)]);
reject(_) -> reject(_) ->
ok. ok.