Don't deop after removing bans If bot fails to get op, and is opped later.
This commit is contained in:
@ -907,8 +907,9 @@ class Bantracker(callbacks.Plugin):
|
||||
def _getOpOK(self, channel):
|
||||
try:
|
||||
schedule.removeEvent('Bantracker_getop_%s' % channel)
|
||||
return True
|
||||
except KeyError:
|
||||
pass
|
||||
return False
|
||||
|
||||
def removeBans(self, irc, channel, modes, deop=False):
|
||||
# send unban messages, with 4 modes max each.
|
||||
@ -1109,11 +1110,11 @@ class Bantracker(callbacks.Plugin):
|
||||
if ircutils.nickEqual(irc.nick, param[1]):
|
||||
opped = self.opped[channel] = mode[0] == '+'
|
||||
if opped == True:
|
||||
self._getOpOK(channel)
|
||||
opped_ok = self._getOpOK(channel)
|
||||
# check if we have bans to remove
|
||||
if channel in self.pendingBanremoval:
|
||||
modes = self.pendingBanremoval.pop(channel)
|
||||
self.removeBans(irc, channel, modes, deop=True)
|
||||
self.removeBans(irc, channel, modes, deop=opped_ok)
|
||||
continue
|
||||
|
||||
# channel mask stuff
|
||||
|
@ -609,6 +609,9 @@ class BantrackerTestCase(ChannelPluginTestCase):
|
||||
msg = self.irc.takeMsg() # fail msg
|
||||
self.assertEqual(str(msg).strip(),
|
||||
"NOTICE #test :Failed to get op in #test")
|
||||
self.op()
|
||||
msg = self.irc.takeMsg() # unban msg
|
||||
self.assertEqual(str(msg).strip(), "MODE #test -b :asd!*@*")
|
||||
finally:
|
||||
pluginConf.autoremove.notify.channels.set('')
|
||||
|
||||
|
Reference in New Issue
Block a user