mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-12 05:02:33 +01:00
First attempt at handling channel TS @ burst (#93)
Doesn't quite work yet, more testing needed.
This commit is contained in:
parent
411b6c4702
commit
bf3116d704
@ -479,9 +479,15 @@ 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 = irc.channels[channel].modes
|
modes = c.modes
|
||||||
log.debug('(%s) Relay mode: channel data for %s%s: %s', irc.name, remoteirc.name, remotechan, remoteirc.channels[remotechan])
|
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
|
||||||
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:
|
||||||
@ -660,6 +666,8 @@ 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
|
||||||
@ -678,8 +686,10 @@ def relayJoins(irc, channel, users, ts, modes):
|
|||||||
# Only join users if they aren't already joined. This prevents op floods
|
# Only join users if they aren't already joined. This prevents op floods
|
||||||
# on charybdis from all the SJOINing.
|
# on charybdis from all the SJOINing.
|
||||||
if u not in remoteirc.channels[channel].users:
|
if u not in remoteirc.channels[channel].users:
|
||||||
ts = irc.channels[channel].ts
|
if ts < rts:
|
||||||
prefixes = getPrefixModes(irc, remoteirc, channel, user)
|
prefixes = getPrefixModes(irc, remoteirc, channel, user)
|
||||||
|
else:
|
||||||
|
prefixes = ''
|
||||||
userpair = (prefixes, u)
|
userpair = (prefixes, u)
|
||||||
queued_users.append(userpair)
|
queued_users.append(userpair)
|
||||||
log.debug('(%s) relayJoins: joining %s to %s%s', irc.name, userpair, remoteirc.name, remotechan)
|
log.debug('(%s) relayJoins: joining %s to %s%s', irc.name, userpair, remoteirc.name, remotechan)
|
||||||
|
@ -367,6 +367,9 @@ def handle_fjoin(irc, servernumeric, command, args):
|
|||||||
log.debug('(%s) Setting channel TS of %s to %s from %s',
|
log.debug('(%s) Setting channel TS of %s to %s from %s',
|
||||||
irc.name, channel, their_ts, our_ts)
|
irc.name, channel, their_ts, our_ts)
|
||||||
irc.channels[channel].ts = their_ts
|
irc.channels[channel].ts = their_ts
|
||||||
|
irc.channels[channel].modes.clear()
|
||||||
|
for p in irc.channels[channel].prefixmodes.values():
|
||||||
|
p.clear()
|
||||||
modestring = args[2:-1] or args[2]
|
modestring = args[2:-1] or args[2]
|
||||||
parsedmodes = utils.parseModes(irc, channel, modestring)
|
parsedmodes = utils.parseModes(irc, channel, modestring)
|
||||||
utils.applyModes(irc, channel, parsedmodes)
|
utils.applyModes(irc, channel, parsedmodes)
|
||||||
|
@ -82,7 +82,6 @@ def sjoinServer(irc, server, channel, users, ts=None):
|
|||||||
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']]
|
||||||
changedmodes = []
|
|
||||||
while users[:10]:
|
while users[:10]:
|
||||||
uids = []
|
uids = []
|
||||||
namelist = []
|
namelist = []
|
||||||
@ -107,7 +106,7 @@ def sjoinServer(irc, server, channel, users, ts=None):
|
|||||||
ts=ts, users=namelist, channel=channel,
|
ts=ts, users=namelist, channel=channel,
|
||||||
modes=utils.joinModes(modes)))
|
modes=utils.joinModes(modes)))
|
||||||
irc.channels[channel].users.update(uids)
|
irc.channels[channel].users.update(uids)
|
||||||
utils.applyModes(irc, channel, changedmodes)
|
utils.applyModes(irc, channel, modes)
|
||||||
|
|
||||||
def _sendModes(irc, numeric, target, modes, ts=None):
|
def _sendModes(irc, numeric, target, modes, ts=None):
|
||||||
utils.applyModes(irc, target, modes)
|
utils.applyModes(irc, target, modes)
|
||||||
@ -372,6 +371,9 @@ def handle_sjoin(irc, servernumeric, command, args):
|
|||||||
log.debug('(%s) Setting channel TS of %s to %s from %s',
|
log.debug('(%s) Setting channel TS of %s to %s from %s',
|
||||||
irc.name, channel, their_ts, our_ts)
|
irc.name, channel, their_ts, our_ts)
|
||||||
irc.channels[channel].ts = their_ts
|
irc.channels[channel].ts = their_ts
|
||||||
|
irc.channels[channel].modes.clear()
|
||||||
|
for p in irc.channels[channel].prefixmodes.values():
|
||||||
|
p.clear()
|
||||||
modestring = args[2:-1] or args[2]
|
modestring = args[2:-1] or args[2]
|
||||||
parsedmodes = utils.parseModes(irc, channel, modestring)
|
parsedmodes = utils.parseModes(irc, channel, modestring)
|
||||||
utils.applyModes(irc, channel, parsedmodes)
|
utils.applyModes(irc, channel, parsedmodes)
|
||||||
|
Loading…
Reference in New Issue
Block a user