diff --git a/plugins/Ebay.py b/plugins/Ebay.py index 8969ecea8..941ac6954 100644 --- a/plugins/Ebay.py +++ b/plugins/Ebay.py @@ -42,13 +42,14 @@ __revision__ = "$Id$" import plugins +import registry + import conf import utils import plugins import ircutils import privmsgs import callbacks -import configurable def configure(onStart, afterConnect, advanced): @@ -63,29 +64,27 @@ def configure(onStart, afterConnect, advanced): print 'supybot sees such a URL, he will parse the web page for' print 'information and reply with the results.\n' if yn('Do you want the Ebay snarfer enabled by default?') == 'y': - onStart.append('Ebay config auction-snarfer on') + conf.supybot.plugins.Ebay.auctionSnarfer.setValue(True) class EbayError(callbacks.Error): pass -class Ebay(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin): +conf.registerPlugin('Ebay') +conf.registerChannelValue(conf.supybot.plugins.Ebay, 'auctionSnarfer', + registry.Boolean(False, """Determines whether the bot will automatically + 'snarf' Ebay auction URLs and print information about them.""")) + +class Ebay(callbacks.PrivmsgCommandAndRegexp): """ Module for eBay stuff. Currently contains a URL snarfer and a command to get info about an auction. """ threaded = True regexps = ['ebaySnarfer'] - configurables = configurable.Dictionary( - [('auction-snarfer', configurable.BoolType, False, - """Determines whether the bot will automatically 'snarf' Ebay auction - URLs and print information about them.""")] - ) def __init__(self): - configurable.Mixin.__init__(self) callbacks.PrivmsgCommandAndRegexp.__init__(self) def die(self): - configurable.Mixin.die(self) callbacks.PrivmsgCommandAndRegexp.die(self) _reopts = re.I | re.S @@ -129,7 +128,7 @@ class Ebay(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin): def ebaySnarfer(self, irc, msg, match): r"http://cgi\.ebay\.(?:com(?:.au)?|ca|co.uk)/(?:.*?/)?(?:ws/)?" \ r"eBayISAPI\.dll\?ViewItem(?:&item=\d+|&category=\d+)+" - if not self.configurables.get('auction-snarfer', channel=msg.args[0]): + if not self.registryValue('auctionSnarfer', msg.args[0]): return url = match.group(0) try: diff --git a/plugins/Gameknot.py b/plugins/Gameknot.py index 10abe0e01..25578ac2f 100644 --- a/plugins/Gameknot.py +++ b/plugins/Gameknot.py @@ -41,13 +41,14 @@ import re import sets import urllib2 +import registry + import conf import utils import plugins import ircutils import privmsgs import callbacks -import configurable def configure(onStart, afterConnect, advanced): @@ -63,26 +64,25 @@ def configure(onStart, afterConnect, advanced): print 'supybot sees such a URL, he will parse the web page for' print 'information and reply with the results.\n' if yn('Do you want the Gameknot stats snarfer enabled by default?')==\ - 'n': - onStart.append('Gameknot toggle stat off') + 'y': + conf.supybot.plugins.Gameknot.statSnarfer.setValue(True) if yn('Do you want the Gameknot Game links snarfer enabled by ' - 'default?') == 'n': - onStart.append('Gameknot toggle stat off') + 'default?') == 'y': + conf.supybot.plugins.Gameknot.gameSnarfer.setValue(True) +conf.registerPlugin('Gameknot') +conf.registerChannelValue(conf.supybot.plugins.Gameknot, 'gameSnarfer', + registry.Boolean(False, """Determines whether the game URL snarfer is + enabled. If so, the bot will reply to the channel with a summary of the + game data when it sees a Gameknot game link on the channel.""")) +conf.registerChannelValue(conf.supybot.plugins.Gameknot, 'statSnarfer', + registry.Boolean(False, """Determines whether the stats URL snarfer is + enabled. If so, the bot will reply to the channel with a summary of the + stats of any player whose stats URL is seen on the channel.""")) -class Gameknot(callbacks.PrivmsgCommandAndRegexp, configurable.Mixin): +class Gameknot(callbacks.PrivmsgCommandAndRegexp): threaded = True regexps = ['gameknotSnarfer', 'gameknotStatsSnarfer'] - configurables = configurable.Dictionary( - [('game-snarfer', configurable.BoolType, True, - """Determines whether the game URL snarfer is active; if so, the bot - will reply to the channel with a summary of the game data when it - sees a Gameknot game on the channel."""), - ('stats-snarfer', configurable.BoolType, True, - """Determines whether the stats URL snarfer is active; if so, the bot - will reply to the channel with a summary of the stats of any player - whose stats URL is seen on the channel.""")] - ) _gkrating = re.compile(r'(\d+)') _gkgames = re.compile(r's: