From 99ad2d193e41bff25882c27c0df39f8e12125c13 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 25 Feb 2012 14:02:02 +0100 Subject: [PATCH] BadWords: Fix commit 123c17663732e0130fcf2b3fb53e949667aca4cf. --- plugins/BadWords/plugin.py | 13 +++++++------ src/version.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/plugins/BadWords/plugin.py b/plugins/BadWords/plugin.py index 1ccd092a3..fb8d787c1 100644 --- a/plugins/BadWords/plugin.py +++ b/plugins/BadWords/plugin.py @@ -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 diff --git a/src/version.py b/src/version.py index ddebecdaf..3a565d58a 100644 --- a/src/version.py +++ b/src/version.py @@ -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)'