2003-08-28 18:33:45 +02:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
|
|
###
|
|
|
|
# Copyright (c) 2002, Jeremiah Fincher
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# * Neither the name of the author of this software nor the name of
|
|
|
|
# contributors to this software may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written consent.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
###
|
|
|
|
|
2003-09-03 11:50:04 +02:00
|
|
|
"""
|
|
|
|
Provides commands useful to the owner of the bot; the commands here require
|
|
|
|
their caller to have the 'owner' capability. This plugin is loaded by default.
|
|
|
|
"""
|
|
|
|
|
2003-10-05 14:47:19 +02:00
|
|
|
import fix
|
2003-09-12 20:07:04 +02:00
|
|
|
|
2003-08-28 18:33:45 +02:00
|
|
|
import gc
|
2003-10-14 05:34:47 +02:00
|
|
|
import os
|
2003-08-28 18:33:45 +02:00
|
|
|
import imp
|
|
|
|
import sys
|
|
|
|
import linecache
|
|
|
|
|
|
|
|
import conf
|
|
|
|
import debug
|
2003-09-04 23:41:31 +02:00
|
|
|
import utils
|
2003-08-28 18:33:45 +02:00
|
|
|
import world
|
2003-09-13 17:13:46 +02:00
|
|
|
import ircdb
|
2003-09-25 09:57:17 +02:00
|
|
|
import irclib
|
2003-08-28 18:33:45 +02:00
|
|
|
import ircmsgs
|
|
|
|
import drivers
|
|
|
|
import privmsgs
|
|
|
|
import callbacks
|
|
|
|
|
2003-09-18 07:47:42 +02:00
|
|
|
def loadPluginModule(name):
|
2003-10-04 15:24:51 +02:00
|
|
|
"""Loads (and returns) the module for the plugin with the given name."""
|
2003-10-14 05:34:47 +02:00
|
|
|
files = []
|
|
|
|
for dir in conf.pluginDirs:
|
|
|
|
files.extend(os.listdir(dir))
|
|
|
|
loweredFiles = map(str.lower, files)
|
|
|
|
try:
|
2003-11-15 05:37:04 +01:00
|
|
|
index = loweredFiles.index(name.lower()+'.py')
|
2003-10-14 05:34:47 +02:00
|
|
|
name = os.path.splitext(files[index])[0]
|
|
|
|
except ValueError: # We'd rather raise the ImportError, so we'll let go...
|
|
|
|
pass
|
2003-09-18 07:47:42 +02:00
|
|
|
moduleInfo = imp.find_module(name, conf.pluginDirs)
|
|
|
|
module = imp.load_module(name, *moduleInfo)
|
|
|
|
linecache.checkcache()
|
|
|
|
return module
|
|
|
|
|
|
|
|
def loadPluginClass(irc, module):
|
2003-10-04 15:24:51 +02:00
|
|
|
"""Loads the plugin Class from the given module into the given irc."""
|
2003-09-18 07:47:42 +02:00
|
|
|
callback = module.Class()
|
2003-10-24 11:03:34 +02:00
|
|
|
assert not irc.getCallback(callback.name())
|
2003-09-18 07:47:42 +02:00
|
|
|
irc.addCallback(callback)
|
|
|
|
if hasattr(callback, 'configure'):
|
|
|
|
callback.configure(irc)
|
|
|
|
|
2003-10-21 08:03:57 +02:00
|
|
|
class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
2003-10-21 23:01:43 +02:00
|
|
|
# This plugin must be first; its priority must be lowest; otherwise odd
|
|
|
|
# things will happen when adding callbacks.
|
|
|
|
priority = ~sys.maxint-1 # This must be first!
|
2003-08-28 18:33:45 +02:00
|
|
|
capability = 'owner'
|
2003-11-03 05:36:40 +01:00
|
|
|
_srcPlugins = ('Owner', 'Misc', 'Admin', 'User', 'Channel')
|
2003-08-28 18:33:45 +02:00
|
|
|
def __init__(self):
|
|
|
|
callbacks.Privmsg.__init__(self)
|
2003-09-04 23:46:16 +02:00
|
|
|
setattr(self.__class__, 'exec', self.__class__._exec)
|
2003-11-17 15:07:51 +01:00
|
|
|
self.defaultPlugins = {'capabilities': 'User'}
|
2003-10-30 04:08:52 +01:00
|
|
|
|
2003-11-12 03:18:22 +01:00
|
|
|
def disambiguate(self, irc, tokens, ambiguousCommands=None):
|
|
|
|
if ambiguousCommands is None:
|
|
|
|
ambiguousCommands = {}
|
2003-10-30 04:08:52 +01:00
|
|
|
if tokens:
|
|
|
|
command = callbacks.canonicalName(tokens[0])
|
|
|
|
if command in self.defaultPlugins:
|
|
|
|
tokens.insert(0, self.defaultPlugins[command])
|
2003-11-03 05:36:40 +01:00
|
|
|
else:
|
|
|
|
cbs = callbacks.findCallbackForCommand(irc, command)
|
|
|
|
if len(cbs) > 1:
|
|
|
|
names = [cb.name() for cb in cbs]
|
2003-11-09 15:01:36 +01:00
|
|
|
srcs = [name for name in names if name in self._srcPlugins]
|
|
|
|
if len(srcs) == 1:
|
|
|
|
tokens.insert(0, srcs[0])
|
2003-11-03 05:36:40 +01:00
|
|
|
else:
|
|
|
|
ambiguousCommands[command] = names
|
2003-10-30 04:08:52 +01:00
|
|
|
for elt in tokens:
|
|
|
|
if isinstance(elt, list):
|
2003-11-12 03:18:22 +01:00
|
|
|
self.disambiguate(irc, elt, ambiguousCommands)
|
2003-08-28 18:33:45 +02:00
|
|
|
|
2003-10-21 23:01:43 +02:00
|
|
|
def doPrivmsg(self, irc, msg):
|
|
|
|
callbacks.Privmsg.handled = False
|
2003-11-04 18:34:48 +01:00
|
|
|
if ircdb.checkIgnored(msg.prefix):
|
|
|
|
return
|
2003-10-28 01:22:15 +01:00
|
|
|
s = callbacks.addressed(irc.nick, msg)
|
|
|
|
if s:
|
2003-10-31 19:18:04 +01:00
|
|
|
try:
|
|
|
|
tokens = callbacks.tokenize(s)
|
|
|
|
except SyntaxError, e:
|
|
|
|
irc.queueMsg(callbacks.error(msg, str(e)))
|
|
|
|
return
|
2003-10-30 00:02:27 +01:00
|
|
|
ambiguousCommands = {}
|
2003-11-12 03:18:22 +01:00
|
|
|
self.disambiguate(irc, tokens, ambiguousCommands)
|
2003-10-30 00:02:27 +01:00
|
|
|
if ambiguousCommands:
|
|
|
|
if len(ambiguousCommands) == 1: # Common case.
|
|
|
|
(command, names) = ambiguousCommands.popitem()
|
|
|
|
names.sort()
|
|
|
|
s = 'The command %r is available in the %s plugins. '\
|
|
|
|
'Please specify the plugin whose command you ' \
|
|
|
|
'wish to call by using its name as a command ' \
|
|
|
|
'before calling it.' % \
|
|
|
|
(command, utils.commaAndify(names))
|
|
|
|
else:
|
|
|
|
L = []
|
|
|
|
for (command, names) in ambiguousCommands.iteritems():
|
|
|
|
names.sort()
|
|
|
|
L.append('The command %r is available in the %s '
|
|
|
|
'plugins' %
|
|
|
|
(command, utils.commaAndify(names)))
|
|
|
|
s = '%s; please specify from which plugins to ' \
|
|
|
|
'call these commands.' % '; '.join(L)
|
|
|
|
irc.queueMsg(callbacks.error(msg, s))
|
|
|
|
else:
|
|
|
|
callbacks.IrcObjectProxy(irc, msg, tokens)
|
2003-10-30 04:08:52 +01:00
|
|
|
|
|
|
|
def defaultplugin(self, irc, msg, args):
|
|
|
|
"""<command> [<plugin>]
|
|
|
|
|
|
|
|
Calls <command> from <plugin> by default, rather than complaining about
|
|
|
|
multiple plugins providing it. If <plugin> is not provided, remove the
|
|
|
|
currently used default plugin.
|
|
|
|
"""
|
|
|
|
(command, plugin) = privmsgs.getArgs(args, optional=1)
|
|
|
|
command = callbacks.canonicalName(command)
|
|
|
|
cbs = callbacks.findCallbackForCommand(irc, command)
|
|
|
|
if not cbs:
|
|
|
|
irc.error(msg, 'That\'t not a valid command.')
|
|
|
|
return
|
|
|
|
if plugin:
|
|
|
|
self.defaultPlugins[command] = plugin
|
|
|
|
else:
|
|
|
|
try:
|
|
|
|
del self.defaultPlugins[command]
|
|
|
|
except KeyError:
|
|
|
|
irc.error(msg, 'I have no default for that command.')
|
|
|
|
return
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
2003-10-28 01:22:15 +01:00
|
|
|
|
2003-08-28 18:33:45 +02:00
|
|
|
def eval(self, irc, msg, args):
|
2003-09-02 21:55:53 +02:00
|
|
|
"""<expression>
|
|
|
|
|
|
|
|
Evaluates <expression> and returns its value.
|
|
|
|
"""
|
2003-08-28 18:33:45 +02:00
|
|
|
if conf.allowEval:
|
|
|
|
s = privmsgs.getArgs(args)
|
|
|
|
try:
|
|
|
|
irc.reply(msg, repr(eval(s)))
|
2003-09-01 08:47:22 +02:00
|
|
|
except SyntaxError, e:
|
|
|
|
irc.reply(msg, '%s: %r' % (debug.exnToString(e), s))
|
2003-08-28 18:33:45 +02:00
|
|
|
except Exception, e:
|
|
|
|
irc.reply(msg, debug.exnToString(e))
|
|
|
|
else:
|
|
|
|
irc.error(msg, conf.replyEvalNotAllowed)
|
|
|
|
|
|
|
|
def _exec(self, irc, msg, args):
|
2003-09-02 21:55:53 +02:00
|
|
|
"""<statement>
|
|
|
|
|
|
|
|
Execs <code>. Returns success if it didn't raise any exceptions.
|
|
|
|
"""
|
2003-08-28 18:33:45 +02:00
|
|
|
if conf.allowEval:
|
|
|
|
s = privmsgs.getArgs(args)
|
|
|
|
try:
|
|
|
|
exec s
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
except Exception, e:
|
|
|
|
irc.reply(msg, debug.exnToString(e))
|
|
|
|
else:
|
|
|
|
irc.error(msg, conf.replyEvalNotAllowed)
|
|
|
|
|
2003-09-22 10:36:12 +02:00
|
|
|
def setconf(self, irc, msg, args):
|
2003-10-21 01:22:40 +02:00
|
|
|
"""[<name> [<value>]]
|
2003-09-22 10:36:12 +02:00
|
|
|
|
2003-10-21 01:22:40 +02:00
|
|
|
Lists adjustable variables in the conf-module by default, shows the
|
|
|
|
variable type with only the <name> argument and sets the value of the
|
|
|
|
variable to <value> when both arguments are given.
|
2003-09-22 10:36:12 +02:00
|
|
|
"""
|
2003-11-11 14:20:06 +01:00
|
|
|
(name, value) = privmsgs.getArgs(args, required=0, optional=2)
|
2003-10-21 01:22:40 +02:00
|
|
|
if name and value:
|
|
|
|
if conf.allowEval:
|
2003-09-22 10:36:12 +02:00
|
|
|
try:
|
2003-10-21 01:22:40 +02:00
|
|
|
value = eval(value)
|
|
|
|
except Exception, e:
|
|
|
|
irc.error(msg, debug.exnToString(e))
|
2003-09-22 10:36:12 +02:00
|
|
|
return
|
|
|
|
setattr(conf, name, value)
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
2003-10-21 01:22:40 +02:00
|
|
|
else:
|
|
|
|
if name == 'allowEval':
|
|
|
|
irc.error(msg, 'You can\'t set the value of allowEval.')
|
|
|
|
return
|
|
|
|
elif name not in conf.types:
|
|
|
|
irc.error(msg, 'I can\'t set that conf variable.')
|
|
|
|
return
|
|
|
|
else:
|
|
|
|
converter = conf.types[name]
|
|
|
|
try:
|
|
|
|
value = converter(value)
|
|
|
|
except ValueError, e:
|
|
|
|
irc.error(msg, str(e))
|
|
|
|
return
|
|
|
|
setattr(conf, name, value)
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
elif name:
|
2003-10-30 03:13:12 +01:00
|
|
|
typeNames = {conf.mystr: 'string',
|
|
|
|
conf.mybool: 'boolean',
|
|
|
|
float: 'float'}
|
2003-10-21 01:22:40 +02:00
|
|
|
try:
|
2003-10-30 03:13:12 +01:00
|
|
|
type = typeNames[conf.types[name]]
|
2003-10-21 01:22:40 +02:00
|
|
|
except KeyError:
|
2003-10-30 03:13:12 +01:00
|
|
|
irc.error(msg, 'That configuration variable doesn\'t exist.')
|
2003-10-21 01:22:40 +02:00
|
|
|
return
|
|
|
|
try:
|
2003-10-30 03:13:12 +01:00
|
|
|
value = getattr(conf, name)
|
|
|
|
irc.reply(msg, '%s is a %s (%s).' % (name, type, value))
|
2003-10-21 01:22:40 +02:00
|
|
|
except KeyError:
|
|
|
|
irc.error(msg, '%s is of an unknown type.' % name)
|
|
|
|
else:
|
|
|
|
options = conf.types.keys()
|
|
|
|
options.sort()
|
|
|
|
irc.reply(msg, ', '.join(options))
|
|
|
|
|
2003-08-28 18:33:45 +02:00
|
|
|
def setdefaultcapability(self, irc, msg, args):
|
|
|
|
"""<capability>
|
|
|
|
|
|
|
|
Sets the default capability to be allowed for any command.
|
|
|
|
"""
|
2003-09-17 09:27:11 +02:00
|
|
|
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
2003-09-16 21:01:23 +02:00
|
|
|
conf.defaultCapabilities.add(capability)
|
2003-08-28 18:33:45 +02:00
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
|
|
|
def unsetdefaultcapability(self, irc, msg, args):
|
|
|
|
"""<capability>
|
|
|
|
|
|
|
|
Unsets the default capability for any command.
|
|
|
|
"""
|
2003-09-17 09:27:11 +02:00
|
|
|
capability = callbacks.canonicalName(privmsgs.getArgs(args))
|
2003-09-16 21:01:23 +02:00
|
|
|
conf.defaultCapabilities.remove(capability)
|
2003-08-28 18:33:45 +02:00
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
|
|
|
def settrace(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Starts the function-tracing debug mode; beware that this makes *huge*
|
|
|
|
logfiles.
|
|
|
|
"""
|
|
|
|
sys.settrace(debug.tracer)
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
|
|
|
def unsettrace(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Stops the function-tracing debug mode."""
|
|
|
|
sys.settrace(None)
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
|
|
|
def ircquote(self, irc, msg, args):
|
|
|
|
"""<string to be sent to the server>
|
|
|
|
|
|
|
|
Sends the raw string given to the server.
|
|
|
|
"""
|
|
|
|
s = privmsgs.getArgs(args)
|
|
|
|
try:
|
|
|
|
m = ircmsgs.IrcMsg(s)
|
|
|
|
irc.queueMsg(m)
|
|
|
|
except Exception:
|
|
|
|
debug.recoverableException()
|
|
|
|
irc.error(msg, conf.replyError)
|
|
|
|
|
|
|
|
def quit(self, irc, msg, args):
|
|
|
|
"""[<int return value>]
|
|
|
|
|
|
|
|
Exits the program with the given return value (the default is 0)
|
|
|
|
"""
|
|
|
|
try:
|
|
|
|
i = int(args[0])
|
|
|
|
except (ValueError, IndexError):
|
|
|
|
i = 0
|
|
|
|
for driver in drivers._drivers.itervalues():
|
|
|
|
driver.die()
|
|
|
|
for irc in world.ircs[:]:
|
|
|
|
irc.die()
|
|
|
|
debug.exit(i)
|
|
|
|
|
|
|
|
def flush(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Runs all the periodic flushers in world.flushers.
|
|
|
|
"""
|
|
|
|
world.flush()
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
|
|
|
def upkeep(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Runs the standard upkeep stuff (flushes and gc.collects()).
|
|
|
|
"""
|
2003-09-03 19:27:08 +02:00
|
|
|
collected = world.upkeep()
|
2003-08-28 18:33:45 +02:00
|
|
|
if gc.garbage:
|
2003-09-25 09:57:17 +02:00
|
|
|
irc.reply(msg, 'Garbage! %r' % gc.garbage)
|
2003-08-28 18:33:45 +02:00
|
|
|
else:
|
2003-09-25 09:57:17 +02:00
|
|
|
irc.reply(msg, '%s collected.' % utils.nItems(collected, 'object'))
|
2003-08-28 18:33:45 +02:00
|
|
|
|
|
|
|
def set(self, irc, msg, args):
|
|
|
|
"""<name> <value>
|
|
|
|
|
|
|
|
Sets the runtime variable <name> to <value>. Currently used variables
|
|
|
|
include "noflush" which, if set to true value, will prevent the
|
|
|
|
periodic flushing that normally occurs.
|
|
|
|
"""
|
|
|
|
(name, value) = privmsgs.getArgs(args, optional=1)
|
|
|
|
world.tempvars[name] = value
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
|
|
|
def unset(self, irc, msg, args):
|
|
|
|
"""<name>
|
|
|
|
|
|
|
|
Unsets the value of variables set via the 'set' command.
|
|
|
|
"""
|
|
|
|
name = privmsgs.getArgs(args)
|
|
|
|
try:
|
|
|
|
del world.tempvars[name]
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
except KeyError:
|
|
|
|
irc.error(msg, 'That variable wasn\'t set.')
|
|
|
|
|
|
|
|
def load(self, irc, msg, args):
|
|
|
|
"""<plugin>
|
|
|
|
|
2003-10-14 05:06:47 +02:00
|
|
|
Loads the plugin <plugin> from any of the directories in
|
|
|
|
conf.pluginDirs; usually this includes the main installed directory
|
2003-10-14 05:34:47 +02:00
|
|
|
and 'plugins' in the current directory. Be sure not to have ".py" at
|
|
|
|
the end.
|
2003-08-28 18:33:45 +02:00
|
|
|
"""
|
|
|
|
name = privmsgs.getArgs(args)
|
2003-10-24 11:03:34 +02:00
|
|
|
if irc.getCallback(name):
|
|
|
|
irc.error(msg, 'That module is already loaded.')
|
|
|
|
return
|
2003-08-28 18:33:45 +02:00
|
|
|
try:
|
2003-09-18 07:47:42 +02:00
|
|
|
module = loadPluginModule(name)
|
2003-10-04 00:28:05 +02:00
|
|
|
except ImportError, e:
|
|
|
|
if name in str(e):
|
|
|
|
irc.error(msg, 'No plugin %s exists.' % name)
|
|
|
|
else:
|
|
|
|
irc.error(msg, debug.exnToString(e))
|
2003-08-28 18:33:45 +02:00
|
|
|
return
|
2003-09-18 07:47:42 +02:00
|
|
|
loadPluginClass(irc, module)
|
2003-08-28 18:33:45 +02:00
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
|
|
|
def reload(self, irc, msg, args):
|
2003-09-05 20:47:58 +02:00
|
|
|
"""<plugin>
|
2003-08-28 18:33:45 +02:00
|
|
|
|
|
|
|
Unloads and subsequently reloads the callback by name; use the 'list'
|
|
|
|
command to see a list of the currently loaded callbacks.
|
|
|
|
"""
|
|
|
|
name = privmsgs.getArgs(args)
|
|
|
|
callbacks = irc.removeCallback(name)
|
|
|
|
if callbacks:
|
2003-10-22 00:24:13 +02:00
|
|
|
module = sys.modules[callbacks[0].__module__]
|
|
|
|
if hasattr(module, 'reload'):
|
|
|
|
x = module.reload()
|
2003-08-28 18:33:45 +02:00
|
|
|
try:
|
2003-09-18 07:52:55 +02:00
|
|
|
module = loadPluginModule(name)
|
2003-10-22 00:24:13 +02:00
|
|
|
if hasattr(module, 'reload'):
|
|
|
|
module.reload(x)
|
2003-09-06 03:13:43 +02:00
|
|
|
for callback in callbacks:
|
|
|
|
callback.die()
|
|
|
|
del callback
|
|
|
|
gc.collect()
|
2003-09-18 07:52:55 +02:00
|
|
|
callback = loadPluginClass(irc, module)
|
2003-08-28 18:33:45 +02:00
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
except ImportError:
|
|
|
|
for callback in callbacks:
|
|
|
|
irc.addCallback(callback)
|
|
|
|
irc.error(msg, 'No plugin %s exists.' % name)
|
|
|
|
else:
|
|
|
|
irc.error(msg, 'There was no callback %s.' % name)
|
|
|
|
|
|
|
|
def unload(self, irc, msg, args):
|
2003-09-05 20:47:58 +02:00
|
|
|
"""<plugin>
|
2003-08-28 18:33:45 +02:00
|
|
|
|
|
|
|
Unloads the callback by name; use the 'list' command to see a list
|
|
|
|
of the currently loaded callbacks.
|
|
|
|
"""
|
|
|
|
name = privmsgs.getArgs(args)
|
|
|
|
callbacks = irc.removeCallback(name)
|
|
|
|
if callbacks:
|
|
|
|
for callback in callbacks:
|
|
|
|
callback.die()
|
|
|
|
del callback
|
|
|
|
gc.collect()
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
else:
|
|
|
|
irc.error(msg, 'There was no callback %s' % name)
|
|
|
|
|
2003-09-13 17:13:46 +02:00
|
|
|
def reconf(self, irc, msg, args):
|
|
|
|
"""takes no arguments
|
|
|
|
|
|
|
|
Reloads the configuration files in conf.dataDir: conf/users.conf and
|
|
|
|
conf/channels.conf, by default.
|
|
|
|
"""
|
|
|
|
ircdb.users.reload()
|
|
|
|
ircdb.channels.reload()
|
|
|
|
irc.reply(msg, conf.replySuccess)
|
|
|
|
|
2003-08-28 18:33:45 +02:00
|
|
|
|
2003-10-21 08:03:57 +02:00
|
|
|
Class = Owner
|
2003-08-28 18:33:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
|
|
|
|