mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
BadWords: Only send a msg stripped of formatting if it had bad words
Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
parent
84ca6f2ae3
commit
5301390290
@ -1,5 +1,6 @@
|
|||||||
###
|
###
|
||||||
# Copyright (c) 2002-2004, Jeremiah Fincher
|
# Copyright (c) 2002-2004, Jeremiah Fincher
|
||||||
|
# Copyright (c) 2009, James Vega
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -84,15 +85,16 @@ class BadWords(callbacks.Privmsg):
|
|||||||
if self.lastModified < self.words.lastModified:
|
if self.lastModified < self.words.lastModified:
|
||||||
self.makeRegexp(self.words())
|
self.makeRegexp(self.words())
|
||||||
self.lastModified = time.time()
|
self.lastModified = time.time()
|
||||||
|
|
||||||
def outFilter(self, irc, msg):
|
def outFilter(self, irc, msg):
|
||||||
if self.filtering and msg.command == 'PRIVMSG':
|
if self.filtering and msg.command == 'PRIVMSG':
|
||||||
self.updateRegexp()
|
self.updateRegexp()
|
||||||
s = msg.args[1]
|
s = msg.args[1]
|
||||||
if self.registryValue('stripFormatting'):
|
if self.registryValue('stripFormatting'):
|
||||||
s = ircutils.stripFormatting(s)
|
s = ircutils.stripFormatting(s)
|
||||||
s = self.regexp.sub(self.sub, s)
|
t = self.regexp.sub(self.sub, s)
|
||||||
msg = ircmsgs.privmsg(msg.args[0], s, msg=msg)
|
if t != s:
|
||||||
|
msg = ircmsgs.privmsg(msg.args[0], t, msg=msg)
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def makeRegexp(self, iterable):
|
def makeRegexp(self, iterable):
|
||||||
|
Loading…
Reference in New Issue
Block a user