This commit is contained in:
Jeremy Fincher 2004-02-07 11:48:03 +00:00
parent 0525b9a4fa
commit b2efbdc84c

View File

@ -122,6 +122,30 @@ conf.registerGlobalValue(conf.supybot.commands.defaultPlugins,
conf.registerGlobalValue(conf.supybot.commands.defaultPlugins, conf.registerGlobalValue(conf.supybot.commands.defaultPlugins,
'ignore', registry.String('Admin', '')) 'ignore', registry.String('Admin', ''))
class holder(object):
pass
class LogProxy(object):
"""<text>
Logs <text> to the global supybot log at critical priority. Useful for
marking logfiles for later searching.
"""
def __init__(self, log):
self.log = log
self.im_func = holder()
self.im_func.func_name = 'log'
def __call__(self, irc, msg, args):
text = privmsgs.getArgs(args)
log.critical(text)
irc.replySuccess()
def __getattr__(self, attr):
return getattr(self.log, attr)
class Owner(privmsgs.CapabilityCheckingPrivmsg): class Owner(privmsgs.CapabilityCheckingPrivmsg):
# This plugin must be first; its priority must be lowest; otherwise odd # This plugin must be first; its priority must be lowest; otherwise odd
# things will happen when adding callbacks. # things will happen when adding callbacks.
@ -130,6 +154,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
_srcPlugins = ('Admin', 'Channel', 'Config', 'Misc', 'Owner', 'User') _srcPlugins = ('Admin', 'Channel', 'Config', 'Misc', 'Owner', 'User')
def __init__(self): def __init__(self):
callbacks.Privmsg.__init__(self) callbacks.Privmsg.__init__(self)
self.log = LogProxy(self.log)
setattr(self.__class__, 'exec', self.__class__._exec) setattr(self.__class__, 'exec', self.__class__._exec)
for (name, s) in registry._cache.iteritems(): for (name, s) in registry._cache.iteritems():
if name.startswith('supybot.plugins'): if name.startswith('supybot.plugins'):
@ -139,6 +164,10 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
continue continue
conf.registerPlugin(name) conf.registerPlugin(name)
def isCommand(self, methodName):
return methodName == 'log' or \
privmsgs.CapabilityCheckingPrivmsg.isCommand(self, methodName)
def do001(self, irc, msg): def do001(self, irc, msg):
self.log.info('Loading other src/ plugins.') self.log.info('Loading other src/ plugins.')
for s in ('Admin', 'Channel', 'Config', 'Misc', 'User'): for s in ('Admin', 'Channel', 'Config', 'Misc', 'User'):