3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-26 12:43:09 +01:00

relay: monitor SAVE floods by network, not by target nick

This commit is contained in:
James Lu 2015-09-12 16:03:17 -07:00
parent 3a8d3d146c
commit 1c97927b5d

View File

@ -1020,7 +1020,7 @@ def handle_save(irc, numeric, command, args):
nick = remoteirc.users[remoteuser].nick nick = remoteirc.users[remoteuser].nick
# Limit how many times we can attempt to fix our nick, to prevent # Limit how many times we can attempt to fix our nick, to prevent
# floods and such. # floods and such.
if savecache.setdefault(target, 0) <= 5: if savecache.setdefault(irc.name, 0) <= 5:
newnick = normalizeNick(irc, remotenet, nick) newnick = normalizeNick(irc, remotenet, nick)
log.info('(%s) SAVE received for relay client %r (%s), fixing nick to %s', log.info('(%s) SAVE received for relay client %r (%s), fixing nick to %s',
irc.name, target, nick, newnick) irc.name, target, nick, newnick)
@ -1029,7 +1029,7 @@ def handle_save(irc, numeric, command, args):
log.warning('(%s) SAVE received for relay client %r (%s), not ' log.warning('(%s) SAVE received for relay client %r (%s), not '
'fixing nick again due to 5 failed attempts in ' 'fixing nick again due to 5 failed attempts in '
'the last 10 seconds!', irc.name, target, nick) 'the last 10 seconds!', irc.name, target, nick)
savecache[target] += 1 savecache[irc.name] += 1
else: else:
# Somebody else on the network (not a PyLink client) had a nick collision; # Somebody else on the network (not a PyLink client) had a nick collision;
# relay this as a nick change appropriately. # relay this as a nick change appropriately.