remove reload support, since it was broken in the first place (somehow)

This commit is contained in:
Brian S. Stephan 2011-04-27 22:49:04 -05:00
parent be4763f6a5
commit aa6ea083fd
3 changed files with 2 additions and 27 deletions

View File

@ -356,19 +356,6 @@ class DrBotIRC(irclib.IRC):
# guess it was never loaded # guess it was never loaded
return 'Module ' + modname + ' is not loaded.' return 'Module ' + modname + ' is not loaded.'
def reload_module(self, modname):
"""Attempt to reload a module, by removing it from memory and then
re-initializing it.
"""
ret = self.unload_module(modname)
if ret == 'Module ' + modname + ' unloaded.':
ret = self.load_module(modname)
if ret == 'Module ' + modname + ' loaded.':
return 'Module ' + modname + ' reloaded.'
return 'Module ' + modname + ' reload failed. Check the console.'
def list_modules(self): def list_modules(self):
"""List loaded modules.""" """List loaded modules."""

View File

@ -86,7 +86,7 @@ class Module(object):
def unregister_handlers(self): def unregister_handlers(self):
"""Unhook handler functions from the IRC library. Inverse of the above. """Unhook handler functions from the IRC library. Inverse of the above.
This is called by reload, to remove the soon-to-be old object from the server This is called by unload, to remove the soon-to-be old object from the server
global handlers (or whatever has been added via register_handlers). Classes global handlers (or whatever has been added via register_handlers). Classes
inheriting from Module could reimplement this, e.g.: inheriting from Module could reimplement this, e.g.:

View File

@ -79,8 +79,6 @@ class IrcAdmin(Module):
return self.reply(connection, event, self.sub_change_nick(connection, event, nick, userhost, what, admin_unlocked)) return self.reply(connection, event, self.sub_change_nick(connection, event, nick, userhost, what, admin_unlocked))
elif whats[0] == '!load' and admin_unlocked and len(whats) >= 2: elif whats[0] == '!load' and admin_unlocked and len(whats) >= 2:
return self.reply(connection, event, self.sub_load_module(connection, event, nick, userhost, what, admin_unlocked)) return self.reply(connection, event, self.sub_load_module(connection, event, nick, userhost, what, admin_unlocked))
elif whats[0] == '!reload' and admin_unlocked and len(whats) >= 2:
return self.reply(connection, event, self.sub_reload_module(connection, event, nick, userhost, what, admin_unlocked))
elif whats[0] == '!unload' and admin_unlocked and len(whats) >= 2: elif whats[0] == '!unload' and admin_unlocked and len(whats) >= 2:
return self.reply(connection, event, self.sub_unload_module(connection, event, nick, userhost, what, admin_unlocked)) return self.reply(connection, event, self.sub_unload_module(connection, event, nick, userhost, what, admin_unlocked))
elif whats[0] == '!modules': elif whats[0] == '!modules':
@ -157,14 +155,6 @@ class IrcAdmin(Module):
whats = what.split(' ') whats = what.split(' ')
return self.irc.unload_module(whats[1]) return self.irc.unload_module(whats[1])
def sub_reload_module(self, connection, event, nick, userhost, what, admin_unlocked):
"""Attempt to reload a module, by removing it from memory and then
re-initializing it.
"""
whats = what.split(' ')
return self.irc.reload_module(whats[1])
def sub_list_modules(self, connection, event, nick, userhost, what, admin_unlocked): def sub_list_modules(self, connection, event, nick, userhost, what, admin_unlocked):
"""Get the list of loaded modules from DrBotIRC and display it.""" """Get the list of loaded modules from DrBotIRC and display it."""
@ -182,7 +172,7 @@ class IrcAdmin(Module):
"no help available for module foo" "no help available for module foo"
""" """
return """Bot admin commands (do '!help IrcAdmin [cmd] for details): return """Bot admin commands (do '!help IrcAdmin [cmd] for details):
!join, !part, !quit, !autojoin, !save, !nick, !load, !reload, !unload, !modules""" !join, !part, !quit, !autojoin, !save, !nick, !load, !unload, !modules"""
def help_detail(self, command): def help_detail(self, command):
"""Return detailed help for the given command. Return None if there """Return detailed help for the given command. Return None if there
@ -207,8 +197,6 @@ class IrcAdmin(Module):
return "!nick - cause the bot to change its nick" return "!nick - cause the bot to change its nick"
elif words[0] == 'load': elif words[0] == 'load':
return "!load - make the bot load a module dynamically" return "!load - make the bot load a module dynamically"
elif words[0] == 'reload':
return "!reload - reload an already-loaded module"
elif words[0] == 'unload': elif words[0] == 'unload':
return "!unload - unload a loaded module, removing its functionality" return "!unload - unload a loaded module, removing its functionality"
elif words[0] == 'modules': elif words[0] == 'modules':