Update plugins to ignore all non-ACTION CTCP messages.

Also update commands.urlSnarfer to do the same, which allows us to revert
"Don't bother snarfing URLs from non-Action CTCP messages."

This reverts commit 3282e3407e.

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2010-01-28 08:14:44 -05:00
parent 3282e3407e
commit 288d7c6e02
10 changed files with 31 additions and 13 deletions

View File

@ -1,6 +1,6 @@
### ###
# Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2009, James Vega # Copyright (c) 2009-2010, 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
@ -83,8 +83,11 @@ class ChannelStat(irclib.IrcCommandDispatcher):
self.smileys += len(sRe.findall(payload)) self.smileys += len(sRe.findall(payload))
def doPrivmsg(self, msg): def doPrivmsg(self, msg):
isAction = ircmsgs.isAction(msg)
if ircmsgs.isCtcp(msg) and not isAction:
return
self.doPayload(*msg.args) self.doPayload(*msg.args)
if ircmsgs.isAction(msg): if isAction:
self.actions += 1 self.actions += 1
def doTopic(self, msg): def doTopic(self, msg):

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2005, Jeremiah Fincher # Copyright (c) 2005, Jeremiah Fincher
# Copyright (c) 2010, 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
@ -265,6 +266,7 @@ class Karma(callbacks.Plugin):
if not (msg.addressed or msg.repliedTo): if not (msg.addressed or msg.repliedTo):
channel = msg.args[0] channel = msg.args[0]
if irc.isChannel(channel) and \ if irc.isChannel(channel) and \
not ircmsgs.isCtcp(msg) and \
self.registryValue('allowUnaddressedKarma', channel): self.registryValue('allowUnaddressedKarma', channel):
irc = callbacks.SimpleProxy(irc, msg) irc = callbacks.SimpleProxy(irc, msg)
thing = msg.args[1].rstrip() thing = msg.args[1].rstrip()

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2004, Jeremiah Fincher # Copyright (c) 2004, Jeremiah Fincher
# Copyright (c) 2010, 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
@ -34,6 +35,7 @@ import supybot.log as log
import supybot.conf as conf import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
from supybot.commands import * from supybot.commands import *
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
@ -152,6 +154,8 @@ class Later(callbacks.Plugin):
remove = wrap(remove, [('checkCapability', 'admin'), 'something']) remove = wrap(remove, [('checkCapability', 'admin'), 'something'])
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg):
return
notes = self._notes.pop(msg.nick, []) notes = self._notes.pop(msg.nick, [])
# Let's try wildcards. # Let's try wildcards.
removals = [] removals = []

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2004, Brett Kelly # Copyright (c) 2004, Brett Kelly
# Copyright (c) 2010, 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
@ -135,6 +136,8 @@ class Note(callbacks.Plugin):
self.db.close() self.db.close()
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg):
return
self._notify(irc, msg) self._notify(irc, msg)
def doJoin(self, irc, msg): def doJoin(self, irc, msg):

View File

@ -1,6 +1,6 @@
### ###
# Copyright (c) 2004, Daniel DiPaolo # Copyright (c) 2004, Daniel DiPaolo
# Copyright (c) 2008-2009, James Vega # Copyright (c) 2008-2010, 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
@ -212,6 +212,8 @@ class QuoteGrabs(callbacks.Plugin):
self.db = QuoteGrabsDB() self.db = QuoteGrabsDB()
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg):
return
irc = callbacks.SimpleProxy(irc, msg) irc = callbacks.SimpleProxy(irc, msg)
if irc.isChannel(msg.args[0]): if irc.isChannel(msg.args[0]):
(chan, payload) = msg.args (chan, payload) = msg.args

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, 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
@ -339,6 +340,8 @@ class Relay(callbacks.Plugin):
notPunishing(irc, 'not opped') notPunishing(irc, 'not opped')
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg):
return
(channel, text) = msg.args (channel, text) = msg.args
if irc.isChannel(channel): if irc.isChannel(channel):
irc = self._getRealIrc(irc) irc = self._getRealIrc(irc)
@ -350,9 +353,6 @@ class Relay(callbacks.Plugin):
self.log.debug('Refusing to relay %s, ignored by %s.', self.log.debug('Refusing to relay %s, ignored by %s.',
msg.prefix, ignore) msg.prefix, ignore)
return return
if ircmsgs.isCtcp(msg) and \
'AWAY' not in text and 'ACTION' not in text:
return
# Let's try to detect other relay bots. # Let's try to detect other relay bots.
if self._checkRelayMsg(msg): if self._checkRelayMsg(msg):
if self.registryValue('punishOtherRelayBots', channel): if self.registryValue('punishOtherRelayBots', channel):

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, 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
@ -136,6 +137,8 @@ class Seen(callbacks.Plugin):
irc.queueMsg(ircmsgs.names(channel)) irc.queueMsg(ircmsgs.names(channel))
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg):
return
if irc.isChannel(msg.args[0]): if irc.isChannel(msg.args[0]):
channel = msg.args[0] channel = msg.args[0]
said = ircmsgs.prettyPrint(msg) said = ircmsgs.prettyPrint(msg)

View File

@ -1,5 +1,6 @@
### ###
# Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2002-2004, Jeremiah Fincher
# Copyright (c) 2010, 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
@ -65,6 +66,8 @@ class URL(callbacks.Plugin):
self.db = URLDB() self.db = URLDB()
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg):
return
channel = msg.args[0] channel = msg.args[0]
if irc.isChannel(channel): if irc.isChannel(channel):
if ircmsgs.isAction(msg): if ircmsgs.isAction(msg):

View File

@ -36,7 +36,6 @@ import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
from supybot.commands import * from supybot.commands import *
import supybot.plugins as plugins import supybot.plugins as plugins
import supybot.ircmsgs as ircmsgs
import supybot.ircutils as ircutils import supybot.ircutils as ircutils
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
@ -80,8 +79,6 @@ class Web(callbacks.PluginRegexp):
channel = msg.args[0] channel = msg.args[0]
if not irc.isChannel(channel): if not irc.isChannel(channel):
return return
if ircmsgs.isCtcp(msg) and not ircmsgs.isAction(msg):
return
if callbacks.addressed(irc.nick, msg): if callbacks.addressed(irc.nick, msg):
return return
if self.registryValue('titleSnarfer', channel): if self.registryValue('titleSnarfer', channel):

View File

@ -1,6 +1,6 @@
### ###
# Copyright (c) 2002-2005, Jeremiah Fincher # Copyright (c) 2002-2005, Jeremiah Fincher
# Copyright (c) 2009, James Vega # Copyright (c) 2009-2010, 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
@ -109,10 +109,11 @@ def urlSnarfer(f):
def newf(self, irc, msg, match, *L, **kwargs): def newf(self, irc, msg, match, *L, **kwargs):
url = match.group(0) url = match.group(0)
channel = msg.args[0] channel = msg.args[0]
if not irc.isChannel(channel): if not irc.isChannel(channel) or (ircmsgs.isCtcp(msg) and not
ircmsgs.isAction(msg)):
return return
if ircdb.channels.getChannel(channel).lobotomized: if ircdb.channels.getChannel(channel).lobotomized:
self.log.info('Not snarfing in %s: lobotomized.', channel) self.log.debug('Not snarfing in %s: lobotomized.', channel)
return return
if _snarfed.has(channel, url): if _snarfed.has(channel, url):
self.log.info('Throttling snarf of %s in %s.', url, channel) self.log.info('Throttling snarf of %s in %s.', url, channel)