From 8512f52e2770d6d3b5d244370e651f1c3477dee4 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 1 Feb 2005 08:30:58 +0000 Subject: [PATCH] Fixed the Debug plugin actually to work. --- sandbox/Debug/__init__.py | 9 +++++---- sandbox/Debug/plugin.py | 14 +++++++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/sandbox/Debug/__init__.py b/sandbox/Debug/__init__.py index cb150cc48..be259a5c7 100644 --- a/sandbox/Debug/__init__.py +++ b/sandbox/Debug/__init__.py @@ -28,15 +28,16 @@ ### """ -Add a description of the plugin (to be presented to the user inside the wizard) -here. +This is for developers debugging their plugins; it provides an eval command +as well as some other useful commands. """ import supybot import supybot.world as world -# XXX Replace this with an appropriate author or supybot.Author instance. -__author__ = supybot.authors.unknown +__version__ = "%%VERSION%%" + +__author__ = supybot.authors.jemfinch # This is a dictionary mapping supybot.Author instances to lists of # contributions. diff --git a/sandbox/Debug/plugin.py b/sandbox/Debug/plugin.py index eb5d2dfcf..46541fad2 100644 --- a/sandbox/Debug/plugin.py +++ b/sandbox/Debug/plugin.py @@ -42,6 +42,7 @@ import exceptions import supybot.conf as conf import supybot.utils as utils +import supybot.ircdb as ircdb from supybot.commands import * import supybot.privmsgs as privmsgs import supybot.callbacks as callbacks @@ -53,13 +54,20 @@ def getTracer(fd): print >>fd, '%s: %s' % (code.co_filename, code.co_name) return tracer -class Debug(privmsgs.CapabilityCheckingPrivmsg): +class Debug(callbacks.Privmsg): capability = 'owner' - def __init__(self): + def __init__(self, irc): # Setup exec command. + self.__parent = super(Debug, self) + self.__parent.__init__(irc) setattr(self.__class__, 'exec', self.__class__._exec) - privmsgs.CapabilityCheckingPrivmsg.__init__(self) + def callCommand(self, name, irc, msg, *args, **kwargs): + if ircdb.checkCapability(msg.prefix, self.capability): + self.__parent.callCommand(name, irc, msg, *args, **kwargs) + else: + irc.errorNoCapability(self.capability) + _evalEnv = {'_': None, '__': None, '___': None,