From 663e657bf5a82d9c2d1a1f3e9a02709118dc796b Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 5 Feb 2017 21:05:50 -0800 Subject: [PATCH] inspircd: work around extraneous letters sometimes sent in FJOIN TS Anope 1.8 potentially sends a trailing 'd' after the timestamp, which causes int() to error. This is technically valid in InspIRCd S2S because atoi() ignores non-digit characters, but it's strange behaviour either way: <- :3AX FJOIN #monitor 1485462109d + :,3AXAAAAAK Thansk to @koaxirc for reporting. --- protocols/inspircd.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/protocols/inspircd.py b/protocols/inspircd.py index d2a3a19..25a3cc7 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -539,8 +539,13 @@ class InspIRCdProtocol(TS6BaseProtocol): self.irc.channels[channel].users.add(user) - # Statekeeping with timestamps - their_ts = int(args[1]) + # Statekeeping with timestamps. Note: some service packages (Anope 1.8) send a trailing + # 'd' after the timestamp, which we should strip out to prevent int() from erroring. + # This is technically valid in InspIRCd S2S because atoi() ignores non-digit characters, + # but it's strange behaviour either way... + # <- :3AX FJOIN #monitor 1485462109d + :,3AXAAAAAK + their_ts = int(''.join(char for char in args[1] if char.isdigit())) + our_ts = self.irc.channels[channel].ts self.updateTS(servernumeric, channel, their_ts, changedmodes)