RelayLink: disable antiflood

This commit is contained in:
GLolol 2014-08-27 11:42:55 -07:00
parent f0647d54bf
commit 5d2ba03838

View File

@ -348,26 +348,24 @@ class RelayLink(callbacks.Plugin):
msg.tag('relayedMsg') msg.tag('relayedMsg')
relay.targetIRC.sendMsg(msg) relay.targetIRC.sendMsg(msg)
if self.registryValue("antiflood.enable") and (len(self.nonPrivmsgCounter) \ # if self.registryValue("antiflood.enable") and (len(self.floodCounter) \
> self.registryValue("antiflood.nonprivmsgs") or \ # > self.registryValue("antiflood.messages"):
len(self.privmsgCounter) > self.registryValue("antiflood.privmsgs")): # if not self.floodActivated:
if not self.floodActivated: # msgs = self.registryValue("antiflood.privms
msgs = self.registryValue("antiflood.privmsgs") if \ # secs = self.registryValue("antiflood.seconds")
isPrivmsg else self.registryValue("antiflood.nonPrivmsgs") # pr = "" if isPrivmsg else "non-"
secs = self.registryValue("antiflood.seconds") # limit = "({} {}PRIVMSG messages in {} seconds)".format(msgs,pr,secs)
pr = "" if isPrivmsg else "non-" # self.log.info("RelayLink: flood protection triggered on {} {}".format(irc.network,limit))
limit = "({} {}PRIVMSG messages in {} seconds)".format(msgs,pr,secs) # s = ("%(network)s*** Flood detected {}. Not relaying messages for {} seconds!".format(limit, secs))
self.log.info("RelayLink: flood protection triggered on {} {}".format(irc.network,limit)) # self.floodActivated = True
s = ("%(network)s*** Flood detected {}. Not relaying messages for {} seconds!".format(limit, secs)) # for relay in self.relays:
self.floodActivated = True # new_s = format_(relay, s, args)
for relay in self.relays: # if relay.channelRegex.match(channel) and \
new_s = format_(relay, s, args) # relay.networkRegex.match(irc.network) and \
if relay.channelRegex.match(channel) and \ # relay.messageRegex.search(new_s):
relay.networkRegex.match(irc.network) and \ # send(new_s)
relay.messageRegex.search(new_s): # return
send(new_s) # else: self.floodActivated = False
return
else: self.floodActivated = False
if channel is None: if channel is None:
for relay in self.relays: for relay in self.relays: