BadWords: Make configuration variable requireWordBoundaries channel-specific

This commit is contained in:
nyuszika7h 2012-01-08 02:08:33 +08:00 committed by Valentin Lorentz
parent fcfa483efe
commit 123c176637
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@ BadWords = conf.registerPlugin('BadWords')
conf.registerGlobalValue(BadWords, 'words',
LastModifiedSetOfStrings([], _("""Determines what words are
considered to be 'bad' so the bot won't say them.""")))
conf.registerGlobalValue(BadWords,'requireWordBoundaries',
conf.registerChannelValue(BadWords,'requireWordBoundaries',
registry.Boolean(False, _("""Determines whether the bot will require bad
words to be independent words, or whether it will censor them within other
words. For instance, if 'darn' is a bad word, then if this is true, 'darn'

View File

@ -104,7 +104,7 @@ class BadWords(callbacks.Privmsg):
def makeRegexp(self, iterable):
s = '(%s)' % '|'.join(map(re.escape, iterable))
if self.registryValue('requireWordBoundaries'):
if self.registryValue('requireWordBoundaries', channel):
s = r'\b%s\b' % s
self.regexp = re.compile(s, re.I)