mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-27 05:21:10 -05:00
RelayLink: use supybot's default ignore implementation (closes #4)
This commit is contained in:
parent
275fba2498
commit
35e7de2cc2
@ -76,30 +76,6 @@ conf.registerChannelValue(RelayLink, 'includeNetwork',
|
||||
network in relayed PRIVMSGs; if you're only relaying between two networks,
|
||||
it's somewhat redundant, and you may wish to save the space.""")))
|
||||
|
||||
conf.registerGroup(RelayLink, 'ignore')
|
||||
conf.registerChannelValue(RelayLink.ignore, 'nicks',
|
||||
registry.SpaceSeparatedListOfStrings('', _("""Determines a list of nicks for the bot to
|
||||
ignore (takes a space-seperated list).""")))
|
||||
conf.registerChannelValue(RelayLink.ignore, 'affectPrivmsgs',
|
||||
registry.Boolean(True, _("""Determines whether the bot will ignore PRIVMSGs
|
||||
from the nicks listed in ignore. If set to False, the bot will only
|
||||
ignore joins/parts/nicks/modes/quits (not kicks) from those nicks.""")))
|
||||
|
||||
# class FloodPreventionConfigHandler(registry.String):
|
||||
# """Invalid input. This value should be given in the form 'positiveInt:positiveInt'
|
||||
# (amount:seconds)"""
|
||||
# def setValue(self, v):
|
||||
# try:
|
||||
# i = [int(n) for n in v.split(":")]
|
||||
# except ValueError:
|
||||
# self.error()
|
||||
# return
|
||||
# if len(i) < 2 or i[0] < 0 or i[1] < 0:
|
||||
# self.error()
|
||||
# return
|
||||
# else:
|
||||
# registry.String.setValue(self, v)
|
||||
|
||||
conf.registerGroup(RelayLink, 'antiflood')
|
||||
conf.registerGlobalValue(RelayLink.antiflood, 'enable',
|
||||
registry.Boolean(False, _("""Determines whether flood protection should
|
||||
@ -141,18 +117,6 @@ conf.registerGlobalValue(RelayLink, 'substitutes',
|
||||
conf.registerGlobalValue(RelayLink, 'logFailedChanges',
|
||||
registry.Boolean(False, _("""Determines whether the bot should log failed config changes.""")))
|
||||
|
||||
# conf.registerGroup(RelayLink, 'colors')
|
||||
# for name, color in {'info': '02',
|
||||
# 'truncated': '14',
|
||||
# 'mode': '06',
|
||||
# 'join': '03',
|
||||
# 'part': '12',
|
||||
# 'kick': '04',
|
||||
# 'nick': '10',
|
||||
# 'quit': '07'}.items():
|
||||
# conf.registerChannelValue(RelayLink.colors, name,
|
||||
# ColorNumber(color, _("""Color used for relaying %s messages.""") % name))
|
||||
|
||||
conf.registerGroup(RelayLink, 'addall')
|
||||
conf.registerGlobalValue(RelayLink.addall, 'max',
|
||||
registry.NonNegativeInteger(20, _("""Defines the maximum number of channels addall/removeall
|
||||
|
@ -57,7 +57,7 @@ except:
|
||||
|
||||
@internationalizeDocstring
|
||||
class RelayLink(callbacks.Plugin):
|
||||
noIgnore = True
|
||||
# noIgnore = True
|
||||
threaded = True
|
||||
|
||||
class Relay():
|
||||
@ -218,12 +218,7 @@ class RelayLink(callbacks.Plugin):
|
||||
s = msg.args[1]
|
||||
s, args = self.getPrivmsgData(channel, msg.nick, s,
|
||||
self.registryValue('color', channel))
|
||||
ignoreNicks = [ircutils.toLower(item) for item in \
|
||||
self.registryValue('ignore.nicks', msg.args[0])]
|
||||
if self.registryValue('ignore.affectPrivmsgs', msg.args[0]) \
|
||||
and ircutils.toLower(msg.nick) in ignoreNicks:
|
||||
return
|
||||
elif channel not in irc.state.channels: # in private
|
||||
if channel not in irc.state.channels: # in private
|
||||
# cuts off the end of commands, so that passwords
|
||||
# won't be revealed in relayed PM's
|
||||
if callbacks.addressed(irc.nick, msg):
|
||||
@ -250,8 +245,6 @@ class RelayLink(callbacks.Plugin):
|
||||
self.addIRC(irc)
|
||||
|
||||
def doMode(self, irc, msg):
|
||||
ignoreNicks = [ircutils.toLower(item) for item in \
|
||||
self.registryValue('ignore.nicks', msg.args[0])]
|
||||
self.addIRC(irc)
|
||||
self.nonPrivmsgCounter.enqueue([0])
|
||||
args = {'nick': msg.nick, 'channel': msg.args[0],
|
||||
@ -264,7 +257,7 @@ class RelayLink(callbacks.Plugin):
|
||||
self.sendToOthers(irc, msg.args[0], s, args)
|
||||
self.floodActivated = True
|
||||
else: return
|
||||
elif ircutils.toLower(msg.nick) not in ignoreNicks:
|
||||
else:
|
||||
self.floodActivated = False
|
||||
if self.registryValue('color', msg.args[0]):
|
||||
# args['color'] = '\x03%s' % self.registryValue('colors.mode', msg.args[0])
|
||||
@ -278,8 +271,6 @@ class RelayLink(callbacks.Plugin):
|
||||
|
||||
def doJoin(self, irc, msg):
|
||||
args = {'nick': msg.nick, 'channel': msg.args[0], 'userhost': ''}
|
||||
ignoreNicks = [ircutils.toLower(item) for item in \
|
||||
self.registryValue('ignore.nicks', msg.args[0])]
|
||||
self.nonPrivmsgCounter.enqueue([0])
|
||||
if irc.nick == msg.nick:
|
||||
if self.registryValue('color'):
|
||||
@ -294,7 +285,7 @@ class RelayLink(callbacks.Plugin):
|
||||
self.sendToOthers(irc, msg.args[0], s, args)
|
||||
self.floodActivated = True
|
||||
else: return
|
||||
elif ircutils.toLower(msg.nick) not in ignoreNicks:
|
||||
else:
|
||||
self.floodActivated = False
|
||||
if self.registryValue('color', msg.args[0]):
|
||||
args['nick'] = '\x03%s%s\x03' % (self.simpleHash(msg.nick), msg.nick)
|
||||
@ -305,8 +296,6 @@ class RelayLink(callbacks.Plugin):
|
||||
self.sendToOthers(irc, msg.args[0], s, args)
|
||||
|
||||
def doPart(self, irc, msg):
|
||||
ignoreNicks = [ircutils.toLower(item) for item in \
|
||||
self.registryValue('ignore.nicks', msg.args[0])]
|
||||
self.nonPrivmsgCounter.enqueue([0])
|
||||
args = {'nick': msg.nick, 'channel': msg.args[0], 'message': '',
|
||||
'userhost': ''}
|
||||
@ -318,7 +307,7 @@ class RelayLink(callbacks.Plugin):
|
||||
self.sendToOthers(irc, msg.args[0], s, args)
|
||||
self.floodActivated = True
|
||||
else: return
|
||||
elif ircutils.toLower(msg.nick) not in ignoreNicks:
|
||||
else:
|
||||
self.addIRC(irc)
|
||||
self.floodActivated = False
|
||||
if self.registryValue('color', msg.args[0]):
|
||||
@ -358,8 +347,6 @@ class RelayLink(callbacks.Plugin):
|
||||
self.sendToOthers(irc, msg.args[0], s, args)
|
||||
|
||||
def doNick(self, irc, msg):
|
||||
ignoreNicks = [ircutils.toLower(item) for item in \
|
||||
self.registryValue('ignore.nicks')]
|
||||
self.addIRC(irc)
|
||||
args = {'oldnick': msg.nick, 'newnick': msg.args[0]}
|
||||
self.nonPrivmsgCounter.enqueue([0])
|
||||
@ -370,8 +357,7 @@ class RelayLink(callbacks.Plugin):
|
||||
if s:
|
||||
self.sendToOthers(irc, msg.args[0], s, args)
|
||||
self.floodActivated = True
|
||||
else: return
|
||||
elif ircutils.toLower(msg.nick) not in ignoreNicks:
|
||||
else:
|
||||
if self.registryValue('color'):
|
||||
args['oldnick'] = '\x03%s%s\x03' % (self.simpleHash(msg.nick), msg.nick)
|
||||
args['newnick'] = '\x03%s%s\x03' % (self.simpleHash(msg.args[0]), msg.args[0])
|
||||
@ -382,8 +368,6 @@ class RelayLink(callbacks.Plugin):
|
||||
self.sendToOthers(irc, channel, s, args)
|
||||
|
||||
def doQuit(self, irc, msg):
|
||||
ignoreNicks = [ircutils.toLower(item) for item in \
|
||||
self.registryValue('ignore.nicks')]
|
||||
args = {'nick': msg.nick, 'message': msg.args[0]}
|
||||
self.nonPrivmsgCounter.enqueue([0])
|
||||
if msg.nick == irc.nick: # It's us.
|
||||
@ -398,8 +382,7 @@ class RelayLink(callbacks.Plugin):
|
||||
if s:
|
||||
self.sendToOthers(irc, msg.args[0], s, args)
|
||||
self.floodActivated = True
|
||||
else: return
|
||||
elif ircutils.toLower(msg.nick) not in ignoreNicks:
|
||||
else:
|
||||
if self.registryValue('color'):
|
||||
args['nick'] = '\x03%s%s\x03' % (self.simpleHash(msg.nick), msg.nick)
|
||||
s = '%(network)s%(nick)s has quit (%(message)s)'
|
||||
|
Loading…
x
Reference in New Issue
Block a user