mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-25 09:50:39 +01:00
antispam: strip IRC formatting by default before processing
Closes #615.
This commit is contained in:
parent
ebf7443d97
commit
f8e3cfa346
@ -836,6 +836,10 @@ stats:
|
|||||||
# Valid values are "voice", "halfop", and "op". This defaults to "halfop" if not set.
|
# Valid values are "voice", "halfop", and "op". This defaults to "halfop" if not set.
|
||||||
#exempt_level: halfop
|
#exempt_level: halfop
|
||||||
|
|
||||||
|
# Determines whether Antispam should strip formatting before applying filter checks.
|
||||||
|
# Defaults to true if not set.
|
||||||
|
#strip_formatting: true
|
||||||
|
|
||||||
#masshighlight:
|
#masshighlight:
|
||||||
# This block configures options for antispam's mass highlight blocking. It can also be
|
# 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
|
# overridden (as an entire block) per-network by copying its options under
|
||||||
|
@ -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)
|
log.debug("(%s) antispam.masshighlight: skipping processing message %r; it's too short", irc.name, text)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if irc.get_service_option('antispam', 'strip_formatting', True):
|
||||||
|
text = utils.strip_irc_formatting(text)
|
||||||
|
|
||||||
# Strip :, from potential nicks
|
# Strip :, from potential nicks
|
||||||
words = [word.rstrip(':,') for word in text.split()]
|
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()
|
punishment = txf_settings.get('punishment', TEXTFILTER_DEFAULTS['punishment']).lower()
|
||||||
reason = txf_settings.get('reason', TEXTFILTER_DEFAULTS['reason'])
|
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
|
punished = False
|
||||||
for filterglob in txf_globs:
|
for filterglob in txf_globs:
|
||||||
if ircmatch.match(1, filterglob, text):
|
if ircmatch.match(1, filterglob, text):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user