mirror of
https://github.com/jlu5/SupyPlugins.git
synced 2025-04-28 22:41:06 -05:00
RelayNext: make flood detection command-specific too
This commit is contained in:
parent
14b6b9c82e
commit
1c5dd5f0a4
@ -58,7 +58,7 @@ Most of these plugins also have their own READMEs in their folders; you can usua
|
||||
- A small random name generator.
|
||||
|
||||
##### [OperUp](OperUp/README.md)
|
||||
- Allows Supybot to oper up automatically (on connect) and on demand.
|
||||
- Allows Supybot to oper up on configured networks, automatically (on connect) and on demand.
|
||||
|
||||
##### PassGen
|
||||
- Generates random passwords on the fly!
|
||||
@ -71,7 +71,6 @@ Most of these plugins also have their own READMEs in their folders; you can usua
|
||||
- Looks up commonly used UDP and TCP port numbers from Wikipedia: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
|
||||
- **Requires:** [Beautiful Soup 4](http://www.crummy.com/software/BeautifulSoup/bs4/doc/)
|
||||
|
||||
|
||||
##### [RelayNext](RelayNext/README.md)
|
||||
- Next generation relayer plugin, designed with two-way relays in mind.
|
||||
|
||||
|
@ -92,7 +92,7 @@ class RelayNext(callbacks.Plugin):
|
||||
|
||||
# This part facilitates flood protection
|
||||
self.msgcounters = {}
|
||||
self.floodTriggered = False
|
||||
self.floodTriggered = {}
|
||||
|
||||
self.db = {}
|
||||
self.loadDB()
|
||||
@ -236,17 +236,17 @@ class RelayNext(callbacks.Plugin):
|
||||
if len(self.msgcounters[(source, msg.command)]) > maximum:
|
||||
self.log.debug("RelayNext (%s): message from %s blocked by "
|
||||
"flood protection.", irc.network, channel)
|
||||
if self.floodTriggered:
|
||||
if self.floodTriggered.get((source, msg.command)):
|
||||
return
|
||||
c = msg.command.lower()
|
||||
e = format("Flood detected on %s (%s %ss/%s seconds), "
|
||||
"not relaying %ss for %s seconds!", channel,
|
||||
maximum, c, seconds, c, timeout)
|
||||
out_s = self._format(irc, msg, channel, announcement=e)
|
||||
self.floodTriggered = True
|
||||
self.floodTriggered[(source, msg.command)] = True
|
||||
self.log.info("RelayNext (%s): %s", irc.network, e)
|
||||
else:
|
||||
self.floodTriggered = False
|
||||
self.floodTriggered[(source, msg.command)] = False
|
||||
for cn in targets:
|
||||
target, net = cn.split("@")
|
||||
otherIrc = world.getIrc(net)
|
||||
|
Loading…
x
Reference in New Issue
Block a user