Fixed bug in MiscCommands.replyWhenNotCommand that it would respond to unhandled CTCP requests.

This commit is contained in:
Jeremy Fincher 2003-10-21 05:02:48 +00:00
parent 9ca4050b9b
commit 0f30bbc359

View File

@ -53,12 +53,16 @@ def replyWhenNotCommand(irc, msg, notCommands):
apparent command actually isn't a command. Replace it with something that apparent command actually isn't a command. Replace it with something that
suits your purposes more, if you want. suits your purposes more, if you want.
""" """
if len(notCommands) == 1: def isCtcpCommand(s):
s = '%s is not a command.' % notCommands[0] return s.startswith('\x01')
else: if not any(isCtcpCommand, notCommands):
s = '%s are not commands' % \ notCommands = map(repr, notCommands)
utils.commaAndify(notCommands) if len(notCommands) == 1:
irc.queueMsg(callbacks.reply(msg, s)) s = '%s is not a command.' % notCommands[0]
else:
s = '%s are not commands' % \
utils.commaAndify(notCommands)
irc.reply(msg, s)
class MiscCommands(callbacks.Privmsg): class MiscCommands(callbacks.Privmsg):
@ -86,7 +90,7 @@ class MiscCommands(callbacks.Privmsg):
command = callbacks.canonicalName(command) command = callbacks.canonicalName(command)
cbs = callbacks.findCallbackForCommand(irc, command) cbs = callbacks.findCallbackForCommand(irc, command)
if not cbs: if not cbs:
notCommands.append(repr(command)) notCommands.append(command)
elif len(cbs) > 1: elif len(cbs) > 1:
ambiguousCommands[command] = [cb.name() for cb in cbs] ambiguousCommands[command] = [cb.name() for cb in cbs]
if notCommands: if notCommands: