From e6249c41e2ff5a5a345c90e46808bef16fccd59c Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Wed, 10 Apr 2019 01:12:20 +0200 Subject: [PATCH] mod_spam_filter: Also log spam recipient Also log the recipient of rejected stanzas, not just the sender. --- mod_spam_filter/src/mod_spam_filter.erl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mod_spam_filter/src/mod_spam_filter.erl b/mod_spam_filter/src/mod_spam_filter.erl index e5e29d6..0458b1a 100644 --- a/mod_spam_filter/src/mod_spam_filter.erl +++ b/mod_spam_filter/src/mod_spam_filter.erl @@ -480,15 +480,17 @@ trim(S) -> re:replace(S, <<"\\s+$">>, <<>>, [{return, binary}]). -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, 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">>, Err = xmpp:err_policy_violation(Txt, Lang), ejabberd_router:route_error(Msg, Err); -reject(#presence{from = From}) -> - ?INFO_MSG("Rejecting unsolicited presence from ~s", [jid:encode(From)]); +reject(#presence{from = From, to = To}) -> + ?INFO_MSG("Rejecting unsolicited presence from ~s to ~s", + [jid:encode(From), jid:encode(To)]); reject(_) -> ok.