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