From d44a1ad737bf7f0fc9b4baeebd4f6d26f1cc5e7f Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 2 Feb 2005 17:28:03 +0000 Subject: [PATCH] Changed the variable names supybot.plugins.Herald.throttleTime (to throttle) and .throttleTimeAfterPart to .throttle.afterPart. Also changed the default of .throttle.afterPart, so people could test that it works more easily. --- plugins/Herald/config.py | 10 +++++----- plugins/Herald/plugin.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/plugins/Herald/config.py b/plugins/Herald/config.py index 691bc3521..69534e40e 100644 --- a/plugins/Herald/config.py +++ b/plugins/Herald/config.py @@ -44,9 +44,13 @@ conf.registerChannelValue(Herald, 'heralding', registry.Boolean(True, """Determines whether messages will be sent to the channel when a recognized user joins; basically enables or disables the plugin.""")) -conf.registerChannelValue(Herald, 'throttleTime', +conf.registerChannelValue(Herald, 'throttle', registry.PositiveInteger(600, """Determines the minimum number of seconds between heralds.""")) +conf.registerChannelValue(Herald.throttle, 'afterPart', + registry.NonNegativeInteger(0, """Determines the minimum number of seconds + after parting that the bot will not herald the person when he or she + rejoins.""")) conf.registerChannelValue(Herald, 'default', registry.String('', """Sets the default herald to use. If a user has a personal herald specified, that will be used instead. If set to the empty @@ -57,9 +61,5 @@ conf.registerChannelValue(Herald.default, 'notice', conf.registerChannelValue(Herald.default, 'public', registry.Boolean(False, """Determines whether the default herald will be sent publicly.""")) -conf.registerChannelValue(Herald, 'throttleTimeAfterPart', - registry.PositiveInteger(60, """Determines the minimum number of seconds - after parting that the bot will not herald the person when he or she - rejoins.""")) # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78 diff --git a/plugins/Herald/plugin.py b/plugins/Herald/plugin.py index c89aa29e7..30bd109f0 100644 --- a/plugins/Herald/plugin.py +++ b/plugins/Herald/plugin.py @@ -89,10 +89,10 @@ class Herald(callbacks.Privmsg): irc.queueMsg(msgmaker(target, default)) return now = time.time() - throttle = self.registryValue('throttleTime', channel) + throttle = self.registryValue('throttle', channel) if now - self.lastHerald.get((channel, id), 0) > throttle: if (channel, id) in self.lastParts: - i = self.registryValue('throttleTimeAfterPart', channel) + i = self.registryValue('throttle.afterPart', channel) if now - self.lastParts[channel, id] < i: return self.lastHerald[channel, id] = now