Bantracker: when unbanning, if there was a problem reading the db,
bt would fail to remove the ban from self.bans.
This commit is contained in:
parent
0a435b668c
commit
af068e2f91
|
@ -627,17 +627,15 @@ class Bantracker(callbacks.Plugin):
|
||||||
if not self.registryValue('enabled', channel):
|
if not self.registryValue('enabled', channel):
|
||||||
return
|
return
|
||||||
data = self.db_run("SELECT MAX(id) FROM bans where channel=%s and mask=%s", (channel, mask), expect_result=True)
|
data = self.db_run("SELECT MAX(id) FROM bans where channel=%s and mask=%s", (channel, mask), expect_result=True)
|
||||||
if len(data) and not (data[0][0] == None):
|
if data and len(data) and not (data[0][0] == None):
|
||||||
self.db_run("UPDATE bans SET removal=%s , removal_op=%s WHERE id=%s", (now(), nick, int(data[0][0])))
|
self.db_run("UPDATE bans SET removal=%s , removal_op=%s WHERE id=%s", (now(), nick, int(data[0][0])))
|
||||||
if not channel in self.bans:
|
if not channel in self.bans:
|
||||||
self.bans[channel] = []
|
self.bans[channel] = []
|
||||||
idx = None
|
|
||||||
for ban in self.bans[channel]:
|
for ban in self.bans[channel]:
|
||||||
if ban.mask == mask:
|
if ban.mask == mask:
|
||||||
idx = self.bans[channel].index(ban)
|
idx = self.bans[channel].index(ban)
|
||||||
break
|
del self.bans[channel][idx]
|
||||||
if idx != None:
|
# we don't break here because bans might be duplicated.
|
||||||
del self.bans[channel][idx]
|
|
||||||
|
|
||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
(recipients, text) = msg.args
|
(recipients, text) = msg.args
|
||||||
|
|
Loading…
Reference in New Issue