From 452f23946d407ef2633e90ec6f11e9a21613406a Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Fri, 20 Aug 2004 22:27:29 +0000 Subject: [PATCH] Changed defaultHerald to default (now that channel values can have children) and added a public boolean for the default herald. --- plugins/Herald.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/plugins/Herald.py b/plugins/Herald.py index 50c6d6d92..3618a09a3 100644 --- a/plugins/Herald.py +++ b/plugins/Herald.py @@ -71,10 +71,13 @@ conf.registerChannelValue(conf.supybot.plugins.Herald, 'heralding', conf.registerChannelValue(conf.supybot.plugins.Herald, 'throttleTime', registry.PositiveInteger(600, """Determines the minimum number of seconds between heralds.""")) -conf.registerChannelValue(conf.supybot.plugins.Herald, 'defaultHerald', +conf.registerChannelValue(conf.supybot.plugins.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 string, the default herald will be disabled.""")) +conf.registerChannelValue(conf.supybot.plugins.Herald.default, 'public', + registry.Boolean(False, """Determines whether the default herald will be + sent publicly.""")) conf.registerChannelValue(conf.supybot.plugins.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 @@ -101,9 +104,12 @@ class Herald(callbacks.Privmsg): id = ircdb.users.getUserId(msg.prefix) herald = self.db[channel, id] except KeyError: - default = self.registryValue('defaultHerald', channel) + default = self.registryValue('default', channel) if default: - irc.queueMsg(ircmsgs.privmsg(msg.nick, default)) + target = msg.nick + if self.registryValue('default.public', channel): + target = channel + irc.queueMsg(ircmsgs.privmsg(target, default)) return now = time.time() throttle = self.registryValue('throttleTime', channel) @@ -148,19 +154,19 @@ class Herald(callbacks.Privmsg): raise callbacks.ArgumentError for (option, _) in optlist: if option == '--remove': - conf.supybot.plugins.Herald.defaultHerald.set("") + self.setRegistryValue('default', '', channel) irc.replySuccess() return - msg = privmsgs.getArgs(rest, required=0, optional=1) - if not msg: - resp = self.registryValue('defaultHerald', channel) + text = privmsgs.getArgs(rest, required=0, optional=1) + if not text: + resp = self.registryValue('default', channel) if not resp: irc.reply('I do not have a default herald set.') return else: irc.reply(resp) return - conf.supybot.plugins.Herald.defaultHerald.set(msg) + self.setRegistryValue('default', text, channel) irc.replySuccess() def get(self, irc, msg, args):