mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-22 18:14:41 +01:00
BadWords: Fix commit 123c176637
.
This commit is contained in:
parent
e2c1adda7f
commit
99ad2d193e
@ -73,9 +73,9 @@ class BadWords(callbacks.Privmsg):
|
||||
# We need to check for bad words here rather than in doPrivmsg because
|
||||
# messages don't get to doPrivmsg if the user is ignored.
|
||||
if msg.command == 'PRIVMSG':
|
||||
self.updateRegexp()
|
||||
s = ircutils.stripFormatting(msg.args[1])
|
||||
channel = msg.args[0]
|
||||
self.updateRegexp(channel)
|
||||
s = ircutils.stripFormatting(msg.args[1])
|
||||
if ircutils.isChannel(channel) and self.registryValue('kick', channel):
|
||||
if self.regexp.search(s):
|
||||
if irc.nick in irc.state.channels[channel].ops:
|
||||
@ -86,14 +86,15 @@ class BadWords(callbacks.Privmsg):
|
||||
msg.nick, channel)
|
||||
return msg
|
||||
|
||||
def updateRegexp(self):
|
||||
def updateRegexp(self, channel):
|
||||
if self.lastModified < self.words.lastModified:
|
||||
self.makeRegexp(self.words())
|
||||
self.makeRegexp(self.words(), channel)
|
||||
self.lastModified = time.time()
|
||||
|
||||
def outFilter(self, irc, msg):
|
||||
if self.filtering and msg.command == 'PRIVMSG' and self.words():
|
||||
self.updateRegexp()
|
||||
channel = msg.args[0]
|
||||
self.updateRegexp(channel)
|
||||
s = msg.args[1]
|
||||
if self.registryValue('stripFormatting'):
|
||||
s = ircutils.stripFormatting(s)
|
||||
@ -102,7 +103,7 @@ class BadWords(callbacks.Privmsg):
|
||||
msg = ircmsgs.privmsg(msg.args[0], t, msg=msg)
|
||||
return msg
|
||||
|
||||
def makeRegexp(self, iterable):
|
||||
def makeRegexp(self, iterable, channel):
|
||||
s = '(%s)' % '|'.join(map(re.escape, iterable))
|
||||
if self.registryValue('requireWordBoundaries', channel):
|
||||
s = r'\b%s\b' % s
|
||||
|
@ -1,3 +1,3 @@
|
||||
"""stick the various versioning attributes in here, so we only have to change
|
||||
them once."""
|
||||
version = '0.83.4.1+limnoria (2012-02-17T21:59:23+0000)'
|
||||
version = '0.83.4.1+limnoria (2012-02-25T13:02:02+0000)'
|
||||
|
Loading…
Reference in New Issue
Block a user