Merge pull request #989 from GLolol/badwords-1

BadWords: bug fix, don't kick ops, remove unused import
This commit is contained in:
Valentin Lorentz 2015-01-03 20:16:46 +01:00
commit 5b3f4cc159

View File

@ -29,7 +29,6 @@
###
import re
import math
import time
import supybot.conf as conf
@ -77,9 +76,16 @@ class BadWords(callbacks.Privmsg):
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 or \
irc.nick in irc.state.channels[channel].halfops:
if self.words and self.regexp.search(s):
c = irc.state.channels[channel]
cap = ircdb.makeChannelCapability(channel, 'op')
if c.isHalfopPlus(irc.nick):
if c.isHalfopPlus(msg.nick) or \
ircdb.checkCapability(msg.prefix, cap):
self.log.debug("Not kicking %s from %s, because "
"they are halfop+ or can't be "
"kicked.", msg.nick, channel)
else:
message = self.registryValue('kick.message', channel)
irc.queueMsg(ircmsgs.kick(channel, msg.nick, message))
else: