fix, 728 messages doesn't have the same format than 367 ones:

:lindbohm.freenode.net 728 scratDev #ubuntu-bots-test q $r:something m4v!~znc@unaffiliated/m4v 1347139607
:lindbohm.freenode.net 367 scratDev #ubuntu-bots-test new!ban@* lindbohm.freenode.net 1345088056
This commit is contained in:
Elián Hanisch 2012-09-08 18:37:47 -03:00
parent 9b5efcd3c6
commit 364c2c993e

View File

@ -269,7 +269,7 @@ queue = MsgQueue()
class Ban(object):
"""Hold my bans"""
def __init__(self, args=None, quiet=False, **kwargs):
def __init__(self, args=None, **kwargs):
self.id = None
if args:
# in most ircd: args = (nick, channel, mask, who, when)
@ -285,8 +285,6 @@ class Ban(object):
if 'id' in kwargs:
self.id = kwargs['id']
self.ascwhen = time.asctime(time.gmtime(self.when))
if quiet:
self.mask = '%' + self.mask
def __tuple__(self):
return (self.mask, self.who, self.ascwhen)
@ -633,7 +631,14 @@ class Bantracker(callbacks.Plugin):
bans = self.bans[channel]
except KeyError:
bans = self.bans[channel] = []
ban = Ban(msg.args, quiet=quiet)
if quiet:
# args = (nick, channel, mode, mask, who, when)
args = list(msg.args)
del args[2] # drop the 'q' bit
args[2] = '%' + args[2]
ban = Ban(args)
else:
ban = Ban(msg.args)
if ban not in bans:
bans.append(ban)