mirror of
https://github.com/jlu5/PyLink.git
synced 2024-12-26 12:43:09 +01:00
classes: more tweaks to updateTS()
Really fixes #295. Closes #298.
(cherry picked from commit 168f9f972d
)
This commit is contained in:
parent
2326f8b818
commit
0cc405f51e
20
classes.py
20
classes.py
@ -1193,11 +1193,13 @@ class Protocol():
|
|||||||
# mode origin is uplink | IGNORE | MERGE | OVERWRITE
|
# mode origin is uplink | IGNORE | MERGE | OVERWRITE
|
||||||
|
|
||||||
def _clear():
|
def _clear():
|
||||||
log.debug("(%s) Clearing modes from channel %s due to TS change", self.irc.name,
|
log.debug("(%s) Clearing local modes from channel %s due to TS change", self.irc.name,
|
||||||
channel)
|
channel)
|
||||||
self.irc.channels[channel].modes.clear()
|
self.irc.channels[channel].modes.clear()
|
||||||
for p in self.irc.channels[channel].prefixmodes.values():
|
for p in self.irc.channels[channel].prefixmodes.values():
|
||||||
p.clear()
|
for user in p.copy():
|
||||||
|
if not self.irc.isInternalClient(user):
|
||||||
|
p.discard(user)
|
||||||
|
|
||||||
def _apply():
|
def _apply():
|
||||||
if modes:
|
if modes:
|
||||||
@ -1218,24 +1220,18 @@ class Protocol():
|
|||||||
log.debug("(%s/%s) our_ts: %s; their_ts: %s; is the mode origin us? %s", self.irc.name,
|
log.debug("(%s/%s) our_ts: %s; their_ts: %s; is the mode origin us? %s", self.irc.name,
|
||||||
channel, our_ts, their_ts, our_mode)
|
channel, our_ts, their_ts, our_mode)
|
||||||
|
|
||||||
if our_mode:
|
|
||||||
# If the source is us, the TS being used by sjoin() should be considered our TS.
|
|
||||||
log.debug('(%s) Resetting channel TS of %s from %s to %s (outgoing)',
|
|
||||||
self.irc.name, channel, self.irc.channels[channel].ts, their_ts)
|
|
||||||
self.irc.channels[channel].ts = our_ts = their_ts
|
|
||||||
|
|
||||||
if their_ts == our_ts:
|
if their_ts == our_ts:
|
||||||
log.debug("(%s/%s) remote TS of %s is equal to our %s; mode query %s",
|
log.debug("(%s/%s) remote TS of %s is equal to our %s; mode query %s",
|
||||||
self.irc.name, channel, their_ts, our_ts, modes)
|
self.irc.name, channel, their_ts, our_ts, modes)
|
||||||
# Their TS is equal to ours. Merge modes.
|
# Their TS is equal to ours. Merge modes.
|
||||||
_apply()
|
_apply()
|
||||||
|
|
||||||
elif (their_ts < our_ts) and (not our_mode):
|
elif (their_ts < our_ts):
|
||||||
log.debug('(%s) Resetting channel TS of %s from %s to %s (incoming)',
|
log.debug('(%s) Resetting channel TS of %s from %s to %s (remote has lower TS)',
|
||||||
self.irc.name, channel, self.irc.channels[channel].ts, their_ts)
|
self.irc.name, channel, our_ts, their_ts)
|
||||||
self.irc.channels[channel].ts = their_ts
|
self.irc.channels[channel].ts = their_ts
|
||||||
|
|
||||||
# Remote TS was lower and we're receiving modes. Clear the modelist an apply theirs.
|
# Remote TS was lower and we're receiving modes. Clear the modelist and apply theirs.
|
||||||
|
|
||||||
_clear()
|
_clear()
|
||||||
_apply()
|
_apply()
|
||||||
|
Loading…
Reference in New Issue
Block a user