From 2eedf7dfadb55f072ea68f344551552b4b5147e7 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 3 Aug 2004 07:20:53 +0000 Subject: [PATCH] Added Owner.rename, to rename commands. --- ChangeLog | 3 +++ src/Owner.py | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7d111db0b..f1d4bbffd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ + * Added Owner.rename, a command for renaming commands in other + plugins. + * Added a new plugin, Tail, which will tail logfiles and send the new lines to a configurable list of targets. diff --git a/src/Owner.py b/src/Owner.py index 7970743fd..36248351f 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -622,6 +622,31 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): raise irc.error('That command wasn\'t disabled.') + def rename(self, irc, msg, args): + """ + + Renames in to the . + """ + (plugin, command, newName) = privmsgs.getArgs(args, required=3) + name = callbacks.canonicalName(newName) + if name != newName: + irc.error('%s is a not a valid new command name. ' + 'Try making it lowercase and removing - and _.' %newName) + return + cb = irc.getCallback(plugin) + if cb is None: + irc.error('%s is not a valid plugin.' % plugin) + return + if not cb.isCommand(command): + s = '%s is not a valid command in the %s plugin.' % (name, plugin) + irc.error(s) + return + method = getattr(cb.__class__, command) + setattr(cb.__class__, name, method) + delattr(cb.__class__, command) + irc.replySuccess() + + Class = Owner