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

updateTS: apply TS on channel regardless of whether mode changes pass

This commit is contained in:
James Lu 2016-06-24 13:15:26 -07:00
parent be19f88e86
commit 7f829ba0ec

View File

@ -1069,15 +1069,15 @@ class Protocol():
""" """
def _clear(): def _clear():
log.debug('(%s) Setting channel TS of %s to %s from %s', log.debug("(%s) Clearing modes from channel %s due to TS change", self.irc.name,
self.irc.name, channel, their_ts, our_ts) channel)
self.irc.channels[channel].ts = their_ts
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() p.clear()
def _apply(): def _apply():
log.debug("(%s) Applying modes on channel %s (TS ok)", self.irc.name,
channel)
self.irc.applyModes(channel, modes) self.irc.applyModes(channel, modes)
our_ts = self.irc.channels[channel].ts our_ts = self.irc.channels[channel].ts
@ -1088,6 +1088,12 @@ class Protocol():
# the one setting modes, just drop them. # the one setting modes, just drop them.
log.debug("(%s/%s) remote TS of %s is lower than ours %s; outbound mode: %s; setting modes %s", log.debug("(%s/%s) remote TS of %s is lower than ours %s; outbound mode: %s; setting modes %s",
self.irc.name, channel, their_ts, our_ts, outbound, modes) self.irc.name, channel, their_ts, our_ts, outbound, modes)
# Update the channel TS to theirs regardless of whether the mode setting passes.
log.debug('(%s) Setting channel TS of %s to %s from %s',
self.irc.name, channel, their_ts, our_ts)
self.irc.channels[channel].ts = their_ts
if not outbound: if not outbound:
_clear() _clear()
_apply() _apply()