mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Moved BadWords's kick-check to an inFilter rather than doPrivmsg, so ignored people can still be kicked.
This commit is contained in:
parent
ecd2c63650
commit
d73b1eecf7
@ -64,6 +64,20 @@ class BadWords(callbacks.Privmsg):
|
|||||||
|
|
||||||
def inFilter(self, irc, msg):
|
def inFilter(self, irc, msg):
|
||||||
self.filtering = True
|
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
|
return msg
|
||||||
|
|
||||||
def updateRegexp(self):
|
def updateRegexp(self):
|
||||||
@ -81,19 +95,6 @@ class BadWords(callbacks.Privmsg):
|
|||||||
msg = ircmsgs.privmsg(msg.args[0], s, msg=msg)
|
msg = ircmsgs.privmsg(msg.args[0], s, msg=msg)
|
||||||
return 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):
|
def makeRegexp(self, iterable):
|
||||||
s = '(%s)' % '|'.join(map(re.escape, iterable))
|
s = '(%s)' % '|'.join(map(re.escape, iterable))
|
||||||
if self.registryValue('requireWordBoundaries'):
|
if self.registryValue('requireWordBoundaries'):
|
||||||
|
0
plugins/RSS/our_feedparser.py
Executable file → Normal file
0
plugins/RSS/our_feedparser.py
Executable file → Normal file
Loading…
Reference in New Issue
Block a user