From c0991ffc05d828de4c85b0942fc967dd32a59c44 Mon Sep 17 00:00:00 2001 From: Luke Rogers Date: Tue, 15 Oct 2013 14:59:45 +1300 Subject: [PATCH] disabled_plugins now disables plugins! --- core/bot.py | 4 ++-- core/loader.py | 6 ++++++ plugins/core_sieve.py | 6 +----- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/core/bot.py b/core/bot.py index 90d4d3b..5c614c6 100644 --- a/core/bot.py +++ b/core/bot.py @@ -147,8 +147,8 @@ class Bot(object): self.loader.stop() self.logger.debug("Stopping plugin loader.") - for name, connection in self.connections.iteritems(): - self.logger.debug("({}) Closing connection.".format(name)) + for connection in self.connections: + self.logger.debug("({}) Closing connection.".format(connection.name)) if reason: connection.cmd("QUIT", [reason]) diff --git a/core/loader.py b/core/loader.py index 365a3ec..5111075 100644 --- a/core/loader.py +++ b/core/loader.py @@ -57,6 +57,12 @@ class PluginLoader(object): def load_file(self, path, loaded_all=False): """loads (or reloads) all valid plugins from a specified file""" filename = os.path.basename(path) + title = os.path.splitext(filename)[0] + + disabled = self.bot.config.get('disabled_plugins', []) + if title in disabled: + self.bot.logger.info("Did not load plugins from: {} (plugin disabled)".format(filename)) + return None # compile the file and eval it in a namespace try: diff --git a/plugins/core_sieve.py b/plugins/core_sieve.py index aeb03f4..18ef611 100755 --- a/plugins/core_sieve.py +++ b/plugins/core_sieve.py @@ -12,14 +12,10 @@ def sieve_suite(bot, input, func, kind, args): return None if kind == "command": - disabled_commands = conn.config.get('disabled_plugins', []) + disabled_commands = conn.config.get('disabled_commands', []) if input.trigger in disabled_commands: return None - fn = re.match(r'^plugins.(.+).py$', func._filename) - disabled = conn.config.get('disabled_plugins', []) - if fn and fn.group(1).lower() in disabled: - return None acl = conn.config.get('acls', {}).get(func.__name__) if acl: