3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

Check for TS changes on SJOIN (both incoming and outgoing)

Restore relay to the devel branch; TS bursts shouldn't be handled there, but in the protocol modules.

TODO: fix prefixmodes being cleared after BURST, and never being reset?
This commit is contained in:
James Lu 2015-08-15 19:53:09 -07:00
parent 0d41e35d9c
commit 4352a68357
3 changed files with 21 additions and 15 deletions

View File

@ -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

View File

@ -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']]

View File

@ -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']]