From 05a5f002a3586de3b27e435047958c9cb742bf3e Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Wed, 10 Apr 2019 01:34:19 +0200 Subject: [PATCH] mod_spam_filter: Return error for presence spam Also return an error stanza for rejected presence spam, not just for rejected messages. --- mod_spam_filter/src/mod_spam_filter.erl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mod_spam_filter/src/mod_spam_filter.erl b/mod_spam_filter/src/mod_spam_filter.erl index 0458b1a..3affd0f 100644 --- a/mod_spam_filter/src/mod_spam_filter.erl +++ b/mod_spam_filter/src/mod_spam_filter.erl @@ -485,12 +485,15 @@ reject(#message{from = From, to = To, type = Type, lang = Lang} = Msg) Type /= error -> ?INFO_MSG("Rejecting unsolicited message from ~s to ~s", [jid:encode(From), jid:encode(To)]), - Txt = <<"Your traffic is unsolicited">>, + Txt = <<"Your message is unsolicited">>, Err = xmpp:err_policy_violation(Txt, Lang), ejabberd_router:route_error(Msg, Err); -reject(#presence{from = From, to = To}) -> +reject(#presence{from = From, to = To, lang = Lang} = Presence) -> ?INFO_MSG("Rejecting unsolicited presence from ~s to ~s", - [jid:encode(From), jid:encode(To)]); + [jid:encode(From), jid:encode(To)]), + Txt = <<"Your traffic is unsolicited">>, + Err = xmpp:err_policy_violation(Txt, Lang), + ejabberd_router:route_error(Presence, Err); reject(_) -> ok.