diff --git a/plugins/relay.py b/plugins/relay.py index 8537baf..1e2c047 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -464,15 +464,9 @@ def relayModes(irc, remoteirc, sender, channel, modes=None): log.debug('(%s) Relay mode: remotechan for %s on %s is %s', irc.name, channel, irc.name, remotechan) if remotechan is None: return - rc = remoteirc.channels[remotechan] - c = irc.channels[channel] if modes is None: - modes = c.modes - log.debug('(%s) Relay mode: channel data for %s%s: %s', irc.name, remoteirc.name, remotechan, rc) - if c.ts > rc.ts: - log.debug('(%s) Relay mode: dropping relaying modes %r to %s%s, since our TS (%s) is greater than theirs (%s)', - irc.name, modes, remoteirc.name, remotechan, c.ts, rc.ts) - return + modes = irc.channels[channel].modes + log.debug('(%s) Relay mode: channel data for %s%s: %s', irc.name, remoteirc.name, remotechan, remoteirc.channels[remotechan]) supported_modes = [] log.debug('(%s) Relay mode: initial modelist for %s is %s', irc.name, channel, modes) for modepair in modes: @@ -651,8 +645,6 @@ def relayJoins(irc, channel, users, ts, modes): # bother spawning it. continue log.debug('(%s) relayJoins: got %r for users', irc.name, users) - ts = irc.channels[channel].ts - rts = remoteirc.channels[remotechan].ts for user in users.copy(): if utils.isInternalClient(irc, user) or user not in irc.users: # We don't need to clone PyLink pseudoclients... That's diff --git a/protocols/inspircd.py b/protocols/inspircd.py index be8577b..c5823af 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -71,9 +71,16 @@ def sjoinServer(irc, server, channel, users, ts=None): log.debug('(%s) sjoinServer: got %r for users', irc.name, users) if not server: raise LookupError('No such PyLink PseudoClient exists.') - if ts is None: - ts = irc.channels[channel].ts - log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, ts, + orig_ts = irc.channels[channel].ts + ts = ts or orig_ts + if ts < orig_ts: + log.debug('(%s) sjoinServer: resetting TS of %r from %s to %s (clearing modes)', + irc.name, channel, orig_ts, ts) + irc.channels[channel].ts = ts + irc.channels[channel].modes.clear() + for p in irc.channels[channel].prefixmodes.values(): + p.clear() + log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, ts, time.strftime("%c", time.localtime(ts))) # Strip out list-modes, they shouldn't be ever sent in FJOIN. modes = [m for m in irc.channels[channel].modes if m[0] not in irc.cmodes['*A']] diff --git a/protocols/ts6.py b/protocols/ts6.py index 94c758a..0e8c161 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -77,8 +77,15 @@ def sjoinServer(irc, server, channel, users, ts=None): log.debug('(%s) sjoinServer: got %r for users', irc.name, users) if not server: raise LookupError('No such PyLink PseudoClient exists.') - if ts is None: - ts = irc.channels[channel].ts + orig_ts = irc.channels[channel].ts + ts = ts or orig_ts + if ts < orig_ts: + log.debug('(%s) sjoinServer: resetting TS of %r from %s to %s (clearing modes)', + irc.name, channel, orig_ts, ts) + irc.channels[channel].ts = ts + irc.channels[channel].modes.clear() + for p in irc.channels[channel].prefixmodes.values(): + p.clear() log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, ts, time.strftime("%c", time.localtime(ts))) modes = [m for m in irc.channels[channel].modes if m[0] not in irc.cmodes['*A']]