Untangle previous commit and more.

This commit is contained in:
Krytarik Raido 2021-07-01 12:45:04 +02:00
parent 96ea85c3b9
commit 0659919ad2

View File

@ -3053,12 +3053,12 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
key = '%s%s' % (m, value) key = '%s%s' % (m, value)
if key in chan.mark: if key in chan.mark:
del chan.mark[key] del chan.mark[key]
if (irc.state.channels[channel].isHalfopPlus(irc.nick) if irc.state.channels[channel].isHalfopPlus(irc.nick) \
and not self.registryValue('keepOp', channel=channel)) \ and not (self.registryValue('keepOp', channel=channel)
or chan.deopPending or chan.deopAsked: or self.registryValue('doNothingAboutOwnOpStatus', channel=channel)
or chan.deopPending or chan.deopAsked):
# ask for deop, delay it a bit # ask for deop, delay it a bit
if not self.registryValue('doNothingAboutOwnOpStatus', channel=channel): self.unOp(irc, channel)
self.unOp(irc, channel)
# mostly logChannel, and maybe few sync msgs # mostly logChannel, and maybe few sync msgs
if len(i.lowQueue): if len(i.lowQueue):
retickle = True retickle = True
@ -4184,24 +4184,20 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
if chan.deopPending: if chan.deopPending:
return return
def unOpBot(): def unOpBot():
if channel in irc.state.channels: if channel in irc.state.channels \
and irc.state.channels[channel].isHalfopPlus(irc.nick) \
and not (self.registryValue('keepOp', channel=channel)
or chan.deopAsked):
chan.deopPending = False
if not (len(i.queue) or len(chan.queue)): if not (len(i.queue) or len(chan.queue)):
if irc.state.channels[channel].isHalfopPlus(irc.nick) \ chan.deopAsked = True
and not self.registryValue('keepOp', channel=channel): irc.queueMsg(ircmsgs.deop(channel, irc.nick))
if not chan.deopAsked: # little trick here, tickle before setting deopFlag
chan.deopPending = False self.forceTickle = True
chan.deopAsked = True self._tickle(irc)
irc.queueMsg(ircmsgs.deop(channel, irc.nick))
# little trick here, tickle before setting deopFlag
self.forceTickle = True
self._tickle(irc)
else: else:
# reask for deop # reask for deop
if (irc.state.channels[channel].isHalfopPlus(irc.nick) self.unOp(irc, channel)
and not self.registryValue('keepOp', channel=channel)) \
and not chan.deopAsked:
self.deopPending = False
self.unOp(irc, channel)
chan.deopPending = True chan.deopPending = True
schedule.addEvent(unOpBot, float(time.time()+10)) schedule.addEvent(unOpBot, float(time.time()+10))