Changed noExtra to allowExtra and kept the default False.

This commit is contained in:
Jeremy Fincher 2004-10-02 17:46:03 +00:00
parent 51c0fb4cc1
commit 54b6880a80
5 changed files with 17 additions and 16 deletions

View File

@ -100,7 +100,7 @@ class Status(callbacks.Privmsg):
if world.profiling:
L.append('I am currently in code profiling mode.')
irc.reply(' '.join(L))
status = wrap(status, noExtra=True)
status = wrap(status)
def threads(self, irc, msg, args):
"""takes no arguments
@ -114,7 +114,7 @@ class Status(callbacks.Privmsg):
utils.nItems('thread', len(threads)), utils.be(len(threads)),
utils.commaAndify(threads))
irc.reply(s)
threads = wrap(threads, noExtra=True)
threads = wrap(threads)
def net(self, irc, msg, args):
"""takes no arguments
@ -131,7 +131,7 @@ class Status(callbacks.Privmsg):
'I have been connected to %s for %s.' %
(self.recvdMsgs, self.recvdBytes,
self.sentMsgs, self.sentBytes, irc.server, timeElapsed))
net = wrap(net, noExtra=True)
net = wrap(net)
def cpu(self, irc, msg, args):
"""takes no arguments
@ -178,7 +178,7 @@ class Status(callbacks.Privmsg):
except Exception:
self.log.exception('Uncaught exception in cpu.memory:')
irc.reply(utils.normalizeWhitespace(response))
cpu = wrap(cpu, noExtra=True)
cpu = wrap(cpu)
def cmd(self, irc, msg, args):
"""takes no arguments
@ -200,7 +200,7 @@ class Status(callbacks.Privmsg):
utils.nItems('plugin', callbacksPrivmsg, 'command-based'),
utils.nItems('command', world.commandsProcessed))
irc.reply(s)
cmd = wrap(cmd, noExtra=True)
cmd = wrap(cmd)
def commands(self, irc, msg, args):
"""takes no arguments
@ -218,7 +218,7 @@ class Status(callbacks.Privmsg):
commands = list(commands)
commands.sort()
irc.reply(utils.commaAndify(commands))
commands = wrap(commands, noExtra=True)
commands = wrap(commands)
def uptime(self, irc, msg, args):
"""takes no arguments
@ -228,7 +228,7 @@ class Status(callbacks.Privmsg):
response = 'I have been running for %s.' % \
utils.timeElapsed(time.time() - world.startedAt)
irc.reply(response)
uptime = wrap(uptime, noExtra=True)
uptime = wrap(uptime)
def server(self, irc, msg, args):
"""takes no arguments
@ -236,7 +236,7 @@ class Status(callbacks.Privmsg):
Returns the server the bot is on.
"""
irc.reply(irc.server)
server = wrap(server, noExtra=True)
server = wrap(server)
Class = Status

View File

@ -213,7 +213,7 @@ class Success(callbacks.Privmsg):
num = self.db.size(channel)
irc.reply('There %s %s in my database.' %
(utils.be(num), utils.nItems('success', num)))
stats = wrap(stats, ['channeldb'], noExtra=True)
stats = wrap(stats, ['channeldb'])

View File

@ -49,7 +49,7 @@ import supybot.plugins as plugins
import supybot.ircutils as ircutils
import supybot.registry as registry
import supybot.callbacks as callbacks
from supybot.commands import wrap, addWrapper, inChannel
from supybot.commands import wrap, addWrapper, inChannel, getChannel
class TopicFormat(registry.String):
"Value must include $topic, otherwise the actual topic would be left out."
@ -82,6 +82,7 @@ conf.registerChannelValue(conf.supybot.plugins.Topic.undo, 'max',
def canChangeTopic(irc, msg, args, state):
assert not state.channel
getChannel(irc, msg, args, state)
inChannel(irc, msg, args, state)
if state.channel not in irc.state.channels:
irc.error('I\'m not currently in %s.' % state.channel, Raise=True)
@ -198,7 +199,7 @@ class Topic(callbacks.Privmsg):
"""
topic = irc.state.channels[channel].topic
irc.reply(topic)
topic = wrap(topic, ['inChannel'], noExtra=True)
topic = wrap(topic, ['inChannel'])
def add(self, irc, msg, args, channel, topic, insert=False):
"""[<channel>] <topic>

View File

@ -181,7 +181,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
irc.reply(utils.commaAndify(L))
else:
irc.reply('I\'m not currently in any channels.')
channels = wrap(channels, ['private'], noExtra=True)
channels = wrap(channels, ['private'])
def do484(self, irc, msg):
irc = self.pendingNickChanges.get(irc, None)
@ -367,7 +367,7 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg):
irc.reply(utils.commaAndify(imap(repr, ircdb.ignores.hostmasks)))
else:
irc.reply('I\'m not currently globally ignoring anyone.')
ignores = wrap(ignores, noExtra=True)
ignores = wrap(ignores)
Class = Admin

View File

@ -485,7 +485,7 @@ class State(object):
self.channel = None
def args(irc,msg,args, types=[], state=None,
getopts=None, noExtra=False, requireExtra=False, combineRest=True):
getopts=None, allowExtra=False, requireExtra=False, combineRest=True):
if state is None:
state = State(name='unknown', logger=log)
if requireExtra:
@ -596,8 +596,8 @@ def args(irc,msg,args, types=[], state=None,
rest = ' '.join(args)
args = [rest]
callWrapper(types.pop(0))
if noExtra and args:
log.debug('noExtra and args: %r', args)
if args and not allowExtra:
log.debug('args but not allowExtra: %r', args)
raise callbacks.ArgumentError
if requireExtra and not args:
log.debug('requireExtra and not args: %r', args)