3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 09:19:23 +01:00

Merge branch 'devel' of github.com:GLolol/PyLink into devel

This commit is contained in:
James Lu 2016-07-31 20:11:06 -07:00
commit d911045dca

View File

@ -1217,11 +1217,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:
@ -1242,24 +1244,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()