From d73b1eecf7e3317f2f3896018227c1dd16ca79f5 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 12 Mar 2009 13:47:12 -0500 Subject: [PATCH 1/2] Moved BadWords's kick-check to an inFilter rather than doPrivmsg, so ignored people can still be kicked. --- plugins/BadWords/plugin.py | 27 ++++++++++++++------------- plugins/RSS/our_feedparser.py | 0 2 files changed, 14 insertions(+), 13 deletions(-) mode change 100755 => 100644 plugins/RSS/our_feedparser.py diff --git a/plugins/BadWords/plugin.py b/plugins/BadWords/plugin.py index 7025837ed..6157b6600 100644 --- a/plugins/BadWords/plugin.py +++ b/plugins/BadWords/plugin.py @@ -64,6 +64,20 @@ class BadWords(callbacks.Privmsg): def inFilter(self, irc, msg): self.filtering = True + # We need to check for bad words here rather than in doPrivmsg because + # messages don't get to doPrivmsg is the user is ignored. + if msg.command == 'PRIVMSG': + self.updateRegexp() + s = ircutils.stripFormatting(msg.args[1]) + channel = msg.args[0] + if ircutils.isChannel(channel) and self.registryValue('kick', channel): + if self.regexp.search(s): + if irc.nick in irc.state.channels[channel].ops: + message = self.registryValue('kick.message', channel) + irc.queueMsg(ircmsgs.kick(channel, msg.nick, message)) + else: + self.log.warning('Should kick %s from %s, but not opped.', + msg.nick, channel) return msg def updateRegexp(self): @@ -81,19 +95,6 @@ class BadWords(callbacks.Privmsg): msg = ircmsgs.privmsg(msg.args[0], s, msg=msg) return msg - def doPrivmsg(self, irc, msg): - self.updateRegexp() - s = ircutils.stripFormatting(msg.args[1]) - channel = msg.args[0] - if ircutils.isChannel(channel) and self.registryValue('kick', channel): - if self.regexp.search(s): - if irc.nick in irc.state.channels[channel].ops: - message = self.registryValue('kick.message', channel) - irc.queueMsg(ircmsgs.kick(channel, msg.nick, message)) - else: - self.log.warning('Should kick %s from %s, but not opped.', - msg.nick, channel) - def makeRegexp(self, iterable): s = '(%s)' % '|'.join(map(re.escape, iterable)) if self.registryValue('requireWordBoundaries'): diff --git a/plugins/RSS/our_feedparser.py b/plugins/RSS/our_feedparser.py old mode 100755 new mode 100644 From bc70ab8aad2278be5410d7767b468dd3597b5626 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 12 Mar 2009 13:54:05 -0500 Subject: [PATCH 2/2] Fixes SR #2233215. --- src/callbacks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/callbacks.py b/src/callbacks.py index 23c870777..ce76dad55 100644 --- a/src/callbacks.py +++ b/src/callbacks.py @@ -1230,7 +1230,9 @@ class PluginMixin(BasePlugin, irclib.IrcCallback): def __call__(self, irc, msg): irc = SimpleProxy(irc, msg) if msg.command == 'PRIVMSG': - if self.noIgnore or not ircdb.checkIgnored(msg.prefix,msg.args[0]): + if self.noIgnore or \ + not ircutils.isUserHostmask(msg.prefix) or \ # Some services impl. + not ircdb.checkIgnored(msg.prefix,msg.args[0]): self.__parent.__call__(irc, msg) else: self.__parent.__call__(irc, msg)