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

View File

@ -213,7 +213,7 @@ class Success(callbacks.Privmsg):
num = self.db.size(channel) num = self.db.size(channel)
irc.reply('There %s %s in my database.' % irc.reply('There %s %s in my database.' %
(utils.be(num), utils.nItems('success', num))) (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.ircutils as ircutils
import supybot.registry as registry import supybot.registry as registry
import supybot.callbacks as callbacks import supybot.callbacks as callbacks
from supybot.commands import wrap, addWrapper, inChannel from supybot.commands import wrap, addWrapper, inChannel, getChannel
class TopicFormat(registry.String): class TopicFormat(registry.String):
"Value must include $topic, otherwise the actual topic would be left out." "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): def canChangeTopic(irc, msg, args, state):
assert not state.channel assert not state.channel
getChannel(irc, msg, args, state)
inChannel(irc, msg, args, state) inChannel(irc, msg, args, state)
if state.channel not in irc.state.channels: if state.channel not in irc.state.channels:
irc.error('I\'m not currently in %s.' % state.channel, Raise=True) 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 topic = irc.state.channels[channel].topic
irc.reply(topic) irc.reply(topic)
topic = wrap(topic, ['inChannel'], noExtra=True) topic = wrap(topic, ['inChannel'])
def add(self, irc, msg, args, channel, topic, insert=False): def add(self, irc, msg, args, channel, topic, insert=False):
"""[<channel>] <topic> """[<channel>] <topic>

View File

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

View File

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