3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

antispam: strip IRC formatting by default before processing

Closes #615.
This commit is contained in:
James Lu 2018-06-09 16:21:41 -07:00
parent ebf7443d97
commit f8e3cfa346
2 changed files with 10 additions and 0 deletions

View File

@ -836,6 +836,10 @@ stats:
# Valid values are "voice", "halfop", and "op". This defaults to "halfop" if not set.
#exempt_level: halfop
# Determines whether Antispam should strip formatting before applying filter checks.
# Defaults to true if not set.
#strip_formatting: true
#masshighlight:
# This block configures options for antispam's mass highlight blocking. It can also be
# overridden (as an entire block) per-network by copying its options under

View File

@ -177,6 +177,9 @@ def handle_masshighlight(irc, source, command, args):
log.debug("(%s) antispam.masshighlight: skipping processing message %r; it's too short", irc.name, text)
return
if irc.get_service_option('antispam', 'strip_formatting', True):
text = utils.strip_irc_formatting(text)
# Strip :, from potential nicks
words = [word.rstrip(':,') for word in text.split()]
@ -272,6 +275,9 @@ def handle_textfilter(irc, source, command, args):
punishment = txf_settings.get('punishment', TEXTFILTER_DEFAULTS['punishment']).lower()
reason = txf_settings.get('reason', TEXTFILTER_DEFAULTS['reason'])
if irc.get_service_option('antispam', 'strip_formatting', True):
text = utils.strip_irc_formatting(text)
punished = False
for filterglob in txf_globs:
if ircmatch.match(1, filterglob, text):