mod_spam_filter: Return error for presence spam

Also return an error stanza for rejected presence spam, not just for
rejected messages.
This commit is contained in:
Holger Weiss 2019-04-10 01:34:19 +02:00
parent e6249c41e2
commit 05a5f002a3
1 changed files with 6 additions and 3 deletions

View File

@ -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.