From 4c949ee6f383c4af3c4c53e056e720086e16f543 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Sun, 17 Jan 2016 09:20:06 -0600 Subject: [PATCH] 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 --- dr_botzo/ircbot/bot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dr_botzo/ircbot/bot.py b/dr_botzo/ircbot/bot.py index de7ab71..607f70f 100644 --- a/dr_botzo/ircbot/bot.py +++ b/dr_botzo/ircbot/bot.py @@ -646,18 +646,19 @@ class IRCBot(irc.client.SimpleIRCClient): dest = ircbotlib.reply_destination_for_event(event) + unloaded = False for path, plugin in self.plugins: if plugin_path == path: + unloaded = True self.plugins.remove((path, plugin)) plugin.stop() del plugin del sys.modules[plugin_path] self.privmsg(dest, "Plugin '{0:s}' unloaded.".format(plugin_path)) - return - # guess it was never loaded - self.privmsg(dest, "Plugin '{0:s}' is not loaded.".format(plugin_path)) + if not unloaded: + self.privmsg(dest, "Plugin '{0:s}' is not loaded.".format(plugin_path)) def privmsg(self, target, text): """Send a PRIVMSG command.