mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +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:
parent
0d41e35d9c
commit
4352a68357
@ -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)
|
log.debug('(%s) Relay mode: remotechan for %s on %s is %s', irc.name, channel, irc.name, remotechan)
|
||||||
if remotechan is None:
|
if remotechan is None:
|
||||||
return
|
return
|
||||||
rc = remoteirc.channels[remotechan]
|
|
||||||
c = irc.channels[channel]
|
|
||||||
if modes is None:
|
if modes is None:
|
||||||
modes = c.modes
|
modes = irc.channels[channel].modes
|
||||||
log.debug('(%s) Relay mode: channel data for %s%s: %s', irc.name, remoteirc.name, remotechan, rc)
|
log.debug('(%s) Relay mode: channel data for %s%s: %s', irc.name, remoteirc.name, remotechan, remoteirc.channels[remotechan])
|
||||||
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
|
|
||||||
supported_modes = []
|
supported_modes = []
|
||||||
log.debug('(%s) Relay mode: initial modelist for %s is %s', irc.name, channel, modes)
|
log.debug('(%s) Relay mode: initial modelist for %s is %s', irc.name, channel, modes)
|
||||||
for modepair in modes:
|
for modepair in modes:
|
||||||
@ -651,8 +645,6 @@ def relayJoins(irc, channel, users, ts, modes):
|
|||||||
# bother spawning it.
|
# bother spawning it.
|
||||||
continue
|
continue
|
||||||
log.debug('(%s) relayJoins: got %r for users', irc.name, users)
|
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():
|
for user in users.copy():
|
||||||
if utils.isInternalClient(irc, user) or user not in irc.users:
|
if utils.isInternalClient(irc, user) or user not in irc.users:
|
||||||
# We don't need to clone PyLink pseudoclients... That's
|
# We don't need to clone PyLink pseudoclients... That's
|
||||||
|
@ -71,9 +71,16 @@ def sjoinServer(irc, server, channel, users, ts=None):
|
|||||||
log.debug('(%s) sjoinServer: got %r for users', irc.name, users)
|
log.debug('(%s) sjoinServer: got %r for users', irc.name, users)
|
||||||
if not server:
|
if not server:
|
||||||
raise LookupError('No such PyLink PseudoClient exists.')
|
raise LookupError('No such PyLink PseudoClient exists.')
|
||||||
if ts is None:
|
orig_ts = irc.channels[channel].ts
|
||||||
ts = irc.channels[channel].ts
|
ts = ts or orig_ts
|
||||||
log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, 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)))
|
time.strftime("%c", time.localtime(ts)))
|
||||||
# Strip out list-modes, they shouldn't be ever sent in FJOIN.
|
# 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']]
|
modes = [m for m in irc.channels[channel].modes if m[0] not in irc.cmodes['*A']]
|
||||||
|
@ -77,8 +77,15 @@ def sjoinServer(irc, server, channel, users, ts=None):
|
|||||||
log.debug('(%s) sjoinServer: got %r for users', irc.name, users)
|
log.debug('(%s) sjoinServer: got %r for users', irc.name, users)
|
||||||
if not server:
|
if not server:
|
||||||
raise LookupError('No such PyLink PseudoClient exists.')
|
raise LookupError('No such PyLink PseudoClient exists.')
|
||||||
if ts is None:
|
orig_ts = irc.channels[channel].ts
|
||||||
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,
|
log.debug("sending SJOIN to %s%s with ts %s (that's %r)", channel, irc.name, ts,
|
||||||
time.strftime("%c", time.localtime(ts)))
|
time.strftime("%c", time.localtime(ts)))
|
||||||
modes = [m for m in irc.channels[channel].modes if m[0] not in irc.cmodes['*A']]
|
modes = [m for m in irc.channels[channel].modes if m[0] not in irc.cmodes['*A']]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user