From 364c2c993e3f90e57e2da3da0783f2b1768cfcb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eli=C3=A1n=20Hanisch?= Date: Sat, 8 Sep 2012 18:37:47 -0300 Subject: [PATCH] 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 --- Bantracker/plugin.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Bantracker/plugin.py b/Bantracker/plugin.py index 2770069..f0f3f33 100644 --- a/Bantracker/plugin.py +++ b/Bantracker/plugin.py @@ -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)