NoTrigger: fix last commit + make blockCtcp toggleable

This commit is contained in:
GLolol 2014-05-18 22:34:27 -07:00
parent 7ca2997727
commit 05a3e5b3b7
2 changed files with 7 additions and 2 deletions

View File

@ -64,5 +64,9 @@ conf.registerChannelValue(NoTrigger.colorAware, 'modes',
registry.SpaceSeparatedListOfStrings("c S", _("""Determines a list of modes that should
be treated as colour-blocking modes. This is usually +c (block) and +S (stripcolour) on
UnrealIRCd/InspIRCd, and just +c (stripcolour) on charybdis-based daemons.""")))
conf.registerChannelValue(NoTrigger, 'blockCtcp',
registry.Boolean(False, _("""Determines whether the bot should block all CTCPs (\001 codes)
except CTCP actions. If you are using the Ctcp plugin, you will want to turn this off.""")))
# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79:

View File

@ -55,7 +55,7 @@ class NoTrigger(callbacks.Plugin):
def outFilter(self, irc, msg):
if msg.command == 'PRIVMSG' and \
ircutils(isChannel(msg.args[0]) and \
ircutils.isChannel(msg.args[0]) and \
self.registryValue('enable', msg.args[0]):
s = msg.args[1]
prefixes = ["+", "$", ";", ".", "%", "!", "`", "\\", "@", "&",
@ -77,7 +77,8 @@ class NoTrigger(callbacks.Plugin):
if s.split()[0][-1] in [",", ":"]:
s = " " + s
# Handle actions properly but destroy any other \001 (CTCP) messages
if s.startswith("\001") and not s.startswith("\001ACTION"):
if self.registryValue('blockCtcp', msg.args[0]) and \
s.startswith("\001") and not s.startswith("\001ACTION"):
s = s[1:-1]
for k, v in rpairs.iteritems():
s = s.replace(k, v)