mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 22:24:20 +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
|
* Added ircutils.strip{Bold,Reverse,Underline,Formatting}, which
|
||||||
will remove the specified formatting or all forms of formatting
|
will remove the specified formatting or all forms of formatting
|
||||||
in the case of stripFormatting.
|
in the case of stripFormatting.
|
||||||
|
@ -47,6 +47,7 @@ import conf
|
|||||||
import utils
|
import utils
|
||||||
import ircdb
|
import ircdb
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
|
import ircutils
|
||||||
import privmsgs
|
import privmsgs
|
||||||
import registry
|
import registry
|
||||||
import callbacks
|
import callbacks
|
||||||
@ -122,6 +123,7 @@ class BadWords(privmsgs.CapabilityCheckingPrivmsg):
|
|||||||
self.makeRegexp(self.words())
|
self.makeRegexp(self.words())
|
||||||
self.lastModified = time.time()
|
self.lastModified = time.time()
|
||||||
s = msg.args[1]
|
s = msg.args[1]
|
||||||
|
s = ircutils.stripFormatting(s)
|
||||||
s = self.regexp.sub(self.sub, s)
|
s = self.regexp.sub(self.sub, s)
|
||||||
return ircmsgs.privmsg(msg.args[0], s)
|
return ircmsgs.privmsg(msg.args[0], s)
|
||||||
else:
|
else:
|
||||||
|
@ -41,6 +41,7 @@ class BadWordsTestCase(PluginTestCase, PluginDocumentation):
|
|||||||
def _test(self):
|
def _test(self):
|
||||||
for word in self.badwords:
|
for word in self.badwords:
|
||||||
self.assertRegexp('echo %s' % word, '(?!%s)' % word)
|
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 foo%sbar' % word, '(?!%s)' % word)
|
||||||
self.assertRegexp('echo [strjoin "" %s]' % ' '.join(word),
|
self.assertRegexp('echo [strjoin "" %s]' % ' '.join(word),
|
||||||
'(?!%s)' % word)
|
'(?!%s)' % word)
|
||||||
|
Loading…
Reference in New Issue
Block a user