ircbot: don't unload just one plugin of path
if we somehow got multiple plugins of the same path loaded, unload them all when unloading, not just the first one we find
This commit is contained in:
parent
310c2aa28d
commit
4c949ee6f3
@ -646,18 +646,19 @@ class IRCBot(irc.client.SimpleIRCClient):
|
|||||||
|
|
||||||
dest = ircbotlib.reply_destination_for_event(event)
|
dest = ircbotlib.reply_destination_for_event(event)
|
||||||
|
|
||||||
|
unloaded = False
|
||||||
for path, plugin in self.plugins:
|
for path, plugin in self.plugins:
|
||||||
if plugin_path == path:
|
if plugin_path == path:
|
||||||
|
unloaded = True
|
||||||
self.plugins.remove((path, plugin))
|
self.plugins.remove((path, plugin))
|
||||||
plugin.stop()
|
plugin.stop()
|
||||||
del plugin
|
del plugin
|
||||||
del sys.modules[plugin_path]
|
del sys.modules[plugin_path]
|
||||||
|
|
||||||
self.privmsg(dest, "Plugin '{0:s}' unloaded.".format(plugin_path))
|
self.privmsg(dest, "Plugin '{0:s}' unloaded.".format(plugin_path))
|
||||||
return
|
|
||||||
|
|
||||||
# guess it was never loaded
|
if not unloaded:
|
||||||
self.privmsg(dest, "Plugin '{0:s}' is not loaded.".format(plugin_path))
|
self.privmsg(dest, "Plugin '{0:s}' is not loaded.".format(plugin_path))
|
||||||
|
|
||||||
def privmsg(self, target, text):
|
def privmsg(self, target, text):
|
||||||
"""Send a PRIVMSG command.
|
"""Send a PRIVMSG command.
|
||||||
|
Loading…
Reference in New Issue
Block a user