Updated. Not finished, but Vee2d2 needs it.

This commit is contained in:
Jeremy Fincher 2004-02-06 04:39:47 +00:00
parent 6e062306f2
commit aff2e6f718

View File

@ -76,10 +76,10 @@ def describePlugin(module, showUsage):
def clearLoadedPlugins(plugins, pluginRegistry): def clearLoadedPlugins(plugins, pluginRegistry):
for plugin in plugins: for plugin in plugins:
try: try:
pluginKey = pluginRegistry.getChild(plugin) pluginKey = pluginRegistry.get(plugin)
if pluginKey(): if pluginKey():
plugins.remove(plugin) plugins.remove(plugin)
except KeyError: except registry.NonExistentRegistryEntry:
continue continue
_windowsVarRe = re.compile(r'%(\w+)%') _windowsVarRe = re.compile(r'%(\w+)%')
@ -314,19 +314,20 @@ def main():
output("""That's not a valid nick. Go ahead and pick another.""") output("""That's not a valid nick. Go ahead and pick another.""")
# conf.supybot.user # conf.supybot.user
output("""If you've ever done a /whois on a person, you know that IRC if advanced:
provides a way for users to show the world their full name. What would output("""If you've ever done a /whois on a person, you know that IRC
you like your bot's full name to be? If you don't care, just press provides a way for users to show the world their full name. What would
enter and it'll be the same as your bot's nick.""") you like your bot's full name to be? If you don't care, just press
user = '' enter and it'll be the same as your bot's nick.""")
try: user = ''
defaultUser = registry._cache['supybot.user'] try:
defaultUser = utils.safeEval(defaultUser) defaultUser = registry._cache['supybot.user']
except KeyError: defaultUser = utils.safeEval(defaultUser)
defaultUser = nick except KeyError:
user = something('What would you like your bot\'s full name to be?', defaultUser = nick
default=defaultUser) user = something('What would you like your bot\'s full name to be?',
conf.supybot.user.set(user) default=defaultUser)
conf.supybot.user.set(user)
# conf.supybot.ident (if advanced) # conf.supybot.ident (if advanced)
try: try:
@ -374,24 +375,25 @@ def main():
except registry.InvalidRegistryValue: except registry.InvalidRegistryValue:
# FIXME: say which ones weren't channels. # FIXME: say which ones weren't channels.
output("""Not all of those are valid IRC channels. Be sure to output("""Not all of those are valid IRC channels. Be sure to
prefix the channel with # (or +, or !, or &, but no one uses those prefix the channel with # (or +, or !, or &, but no one uses
channels, really).""") those channels, really).""")
### ###
# Plugins # Plugins
### ###
def configurePlugin(module, advanced): def configurePlugin(module, advanced):
if hasattr(module, 'configure'): if hasattr(module, 'configure'):
output("""Beginning configuration for %s..."""%module.Class.__name__) output("""Beginning configuration for %s...""" %
module.Class.__name__)
module.configure(advanced) module.configure(advanced)
print # Blank line :) print # Blank line :)
output("""Done!""") output("""Done!""")
else: else:
conf.registerPlugin(module, currentValue=True) conf.registerPlugin(module.__name__, currentValue=True)
plugins = getPlugins(pluginDirs) plugins = getPlugins(pluginDirs)
for s in ('Admin', 'User', 'Channel', 'Misc', 'Config'): for s in ('Admin', 'User', 'Channel', 'Misc', 'Config'):
configurePlugin(s, advanced) configurePlugin(loadPlugin(s), advanced)
clearLoadedPlugins(plugins, conf.supybot.plugins) clearLoadedPlugins(plugins, conf.supybot.plugins)
output("""Now we're going to run you through plugin configuration. There's output("""Now we're going to run you through plugin configuration. There's