diff --git a/src/Owner.py b/src/Owner.py index 4c895eef3..4aceae192 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -157,12 +157,19 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): callbacks.IrcObjectProxy(irc, msg, tokens) def defaultplugin(self, irc, msg, args): - """ [] + """ [] [--remove] Calls from by default, rather than complaining about - multiple plugins providing it. If is not provided, remove the - currently used default plugin. + multiple plugins providing it. If is not provided, shows the + current default plugin for . If --remove is given, removes + the current default plugin for . """ + if '--remove' in args: + while '--remove' in args: + args.remove('--remove') + remove = True + else: + remove = False (command, plugin) = privmsgs.getArgs(args, optional=1) command = callbacks.canonicalName(command) cbs = callbacks.findCallbackForCommand(irc, command) @@ -173,9 +180,12 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): self.defaultPlugins[command] = plugin else: try: - del self.defaultPlugins[command] + if remove: + del self.defaultPlugins[command] + else: + irc.reply(msg, self.defaultPlugins[command]) except KeyError: - irc.error(msg, 'I have no default for that command.') + irc.error(msg,'I have no default plugin for that command.') return irc.reply(msg, conf.replySuccess) diff --git a/test/test_Owner.py b/test/test_Owner.py index 1b779af0e..d05c7f61e 100644 --- a/test/test_Owner.py +++ b/test/test_Owner.py @@ -40,7 +40,8 @@ class OwnerTestCase(PluginTestCase, PluginDocumentation): self.assertError('whois osu.edu') self.assertNotError('defaultplugin whois network') self.assertNotError('whois osu.edu') - self.assertNotError('defaultplugin whois') + self.assertResponse('defaultplugin whois', 'network') + self.assertNotError('defaultplugin --remove whois') self.assertError('whois osu.edu') self.assertError('defaultplugin asdlfkjasdflkjsad Owner')