mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-29 21:54:22 +01:00
BadWords will now filter words that have been formatted
This commit is contained in:
parent
e87c31aea4
commit
b9ab839470
@ -1,3 +1,5 @@
|
||||
* Fixed bug #863601, plugin BadWords fails on color codes.
|
||||
|
||||
* Added ircutils.strip{Bold,Reverse,Underline,Formatting}, which
|
||||
will remove the specified formatting or all forms of formatting
|
||||
in the case of stripFormatting.
|
||||
|
@ -47,6 +47,7 @@ import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
@ -122,6 +123,7 @@ class BadWords(privmsgs.CapabilityCheckingPrivmsg):
|
||||
self.makeRegexp(self.words())
|
||||
self.lastModified = time.time()
|
||||
s = msg.args[1]
|
||||
s = ircutils.stripFormatting(s)
|
||||
s = self.regexp.sub(self.sub, s)
|
||||
return ircmsgs.privmsg(msg.args[0], s)
|
||||
else:
|
||||
|
@ -41,6 +41,7 @@ class BadWordsTestCase(PluginTestCase, PluginDocumentation):
|
||||
def _test(self):
|
||||
for word in self.badwords:
|
||||
self.assertRegexp('echo %s' % word, '(?!%s)' % word)
|
||||
self.assertRegexp('echo [colorize %s]' % word, '(?!%s)' % word)
|
||||
self.assertRegexp('echo foo%sbar' % word, '(?!%s)' % word)
|
||||
self.assertRegexp('echo [strjoin "" %s]' % ' '.join(word),
|
||||
'(?!%s)' % word)
|
||||
|
Loading…
Reference in New Issue
Block a user