From 2936e94f50c342a0928fb762e93500c795522a53 Mon Sep 17 00:00:00 2001 From: James Lu Date: Wed, 22 Jun 2016 22:33:09 -0700 Subject: [PATCH] unreal: warn about mode bounces instead of fighting with the uplink --- protocols/unreal.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/protocols/unreal.py b/protocols/unreal.py index 656a18f..994ba60 100644 --- a/protocols/unreal.py +++ b/protocols/unreal.py @@ -652,10 +652,21 @@ class UnrealProtocol(TS6BaseProtocol): if utils.isChannel(args[0]): channel = self.irc.toLower(args[0]) oldobj = self.irc.channels[channel].deepcopy() + modes = list(filter(None, args[1:])) # normalize whitespace parsedmodes = self.irc.parseModes(channel, modes) + if parsedmodes: + if parsedmodes[0][0] == '+&': + # UnrealIRCd uses a & virtual mode to denote mode bounces, meaning that an attempt to set modes + # by us was rejected for some reason (usually due to timestamps). Warn about this and drop the + # mode change to prevent mode floods. + log.warning("(%s) Received mode bounce %s in channel %s! Our TS: %s", + self.irc.name, modes, channel, self.irc.channels[channel].ts) + return + self.irc.applyModes(channel, parsedmodes) + if numeric in self.irc.servers and args[-1].isdigit(): # Sender is a server AND last arg is number. Perform TS updates. their_ts = int(args[-1])