diff --git a/__init__.py b/__init__.py index fa573e2..4a2d75c 100644 --- a/__init__.py +++ b/__init__.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2013, nicolas coevoet +# Copyright (c) 2013, Nicolas Coevoet # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -37,7 +37,7 @@ import supybot.world as world # Use this for the version of this plugin. You may wish to put a CVS keyword # in here if you're keeping the plugin in CVS or some similar system. -__version__ = "0.4" +__version__ = "0.5" # XXX Replace this with an appropriate author or supybot.Author instance. __author__ = supybot.authors.unknown @@ -47,7 +47,7 @@ __author__ = supybot.authors.unknown __contributors__ = {} # This is a url where the most recent plugin package can be downloaded. -__url__ = '' # 'http://supybot.com/Members/yourname/ListTracker/download' +__url__ = 'https://github.com/ncoevoet/ChanTracker' from . import config from . import plugin @@ -61,6 +61,3 @@ if world.testing: Class = plugin.Class configure = config.configure - - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/config.py b/config.py index ca3de89..c99cf09 100644 --- a/config.py +++ b/config.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2013, nicolas coevoet +# Copyright (c) 2013, Nicolas Coevoet # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/plugin.py b/plugin.py index c866387..553c1ef 100644 --- a/plugin.py +++ b/plugin.py @@ -1128,7 +1128,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): pending = wrap(pending,['op',additional('letter'),optional('hostmask')]) def do (self,irc,msg,args,channel,mode,items,seconds,reason): - """[] [,] [y] [w] [d] [h] [m] [s] [<-1> or empty means forever] + """[] [,] [y] [w] [d] [h] [m] [s] [<-1s> or empty means forever] + targets for duration is mandatory""" if mode in self.registryValue('modesToAsk') or mode in self.registryValue('modesToAskWhenOpped'): @@ -1144,7 +1144,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): do = wrap(do,['op','letter',commalist('something'),any('getTs',True),rest('text')]) def q (self,irc,msg,args,channel,items,seconds,reason): - """[] [,] [y] [w] [d] [h] [m] [s] [<-1> or empty means forever] + """[] [,] [y] [w] [d] [h] [m] [s] [<-1s> or empty means forever] +q targets for duration reason is mandatory""" b = self._adds(irc,msg,args,channel,'q',items,getDuration(seconds),reason) @@ -1156,7 +1156,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): q = wrap(q,['op',commalist('something'),any('getTs',True),rest('text')]) def b (self, irc, msg, args, channel, items, seconds,reason): - """[] [,] [y] [w] [d] [h] [m] [s] [<-1> or empty means forever] + """[] [,] [y] [w] [d] [h] [m] [s] [<-1s> or empty means forever] +b targets for duration reason is mandatory""" b = self._adds(irc,msg,args,channel,'b',items,getDuration(seconds),reason) @@ -1168,7 +1168,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): b = wrap(b,['op',commalist('something'),any('getTs',True),rest('text')]) def i (self, irc, msg, args, channel, items, seconds): - """[] [,] [y] [w] [d] [h] [m] [s] [<-1> or empty means forever] + """[] [,] [y] [w] [d] [h] [m] [s] [<-1s> or empty means forever] +I targets for duration reason is mandatory""" b = self._adds(irc,msg,args,channel,'I',items,getDuration(seconds),reason) @@ -1180,7 +1180,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): i = wrap(i,['op',commalist('something'),any('getTs',True),rest('text')]) def e (self, irc, msg, args, channel, items,seconds,reason): - """[] [,] [y] [w] [d] [h] [m] [s] [<-1> or empty means forever] + """[] [,] [y] [w] [d] [h] [m] [s] [<-1s> or empty means forever] +e targets for duration reason is mandatory""" b = self._adds(irc,msg,args,channel,'e',items,getDuration(seconds),reason) @@ -1848,6 +1848,7 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): removeNick = True if not isBot: n = self.getNick(irc,msg.nick) + best = getBestPattern(n)[0] if reason: n.addLog('ALL','has quit [%s]' % reason) else: @@ -1863,23 +1864,22 @@ class ChanTracker(callbacks.Plugin,plugins.ChannelDBHandler): if nick == msg.nick: self._logChan(irc,channel,'[%s] %s has quit (%s)' % (channel,msg.prefix,reason)) break - best = getBestPattern(n)[0] - if best and not self._isVip(irc,channel,n): - isCycle = self._isSomething(irc,channel,best,'cycle') - if isCycle: - isBad = self._isSomething(irc,channel,best,'bad') - kind = None - if isBad: - kind = 'bad' - else: - kind = 'cycle' - mode = self.registryValue('%sMode' % kind,channel=channel) - if len(mode) > 1: - mode = mode[0] - duration = self.registryValue('%sDuration' % kind,channel=channel) - comment = self.registryValue('%sComment' % kind,channel=channel) - self._act(irc,channel,mode,best,duration,comment) - self.forceTickle = True + if best and not self._isVip(irc,channel,n): + isCycle = self._isSomething(irc,channel,best,'cycle') + if isCycle: + isBad = self._isSomething(irc,channel,best,'bad') + kind = None + if isBad: + kind = 'bad' + else: + kind = 'cycle' + mode = self.registryValue('%sMode' % kind,channel=channel) + if len(mode) > 1: + mode = mode[0] + duration = self.registryValue('%sDuration' % kind,channel=channel) + comment = self.registryValue('%sComment' % kind,channel=channel) + self._act(irc,channel,mode,best,duration,comment) + self.forceTickle = True if removeNick: i = self.getIrc(irc) if msg.nick in i.nicks: diff --git a/test.py b/test.py index 79bc912..2f32293 100644 --- a/test.py +++ b/test.py @@ -1,5 +1,5 @@ ### -# Copyright (c) 2013, nicolas coevoet +# Copyright (c) 2013, Nicolas Coevoet # All rights reserved. # # Redistribution and use in source and binary forms, with or without @@ -33,5 +33,3 @@ from supybot.test import * class ListTrackerTestCase(PluginTestCase): plugins = ('ChanTracker',) - -# vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: