BadWords: Only send a msg stripped of formatting if it had bad words

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-04-14 19:59:59 -04:00
parent 84ca6f2ae3
commit 5301390290

View File

@ -1,5 +1,6 @@
###
# Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -84,15 +85,16 @@ class BadWords(callbacks.Privmsg):
if self.lastModified < self.words.lastModified:
self.makeRegexp(self.words())
self.lastModified = time.time()
def outFilter(self, irc, msg):
if self.filtering and msg.command == 'PRIVMSG':
self.updateRegexp()
s = msg.args[1]
if self.registryValue('stripFormatting'):
s = ircutils.stripFormatting(s)
s = self.regexp.sub(self.sub, s)
msg = ircmsgs.privmsg(msg.args[0], s, msg=msg)
t = self.regexp.sub(self.sub, s)
if t != s:
msg = ircmsgs.privmsg(msg.args[0], t, msg=msg)
return msg
def makeRegexp(self, iterable):