Removed funkyArgument; now we use safeArgument which does the repr() itself.

This commit is contained in:
Jeremy Fincher 2003-04-03 08:31:47 +00:00
parent 10e8965f5d
commit d5c5e1240b
2 changed files with 7 additions and 6 deletions

View File

@ -78,8 +78,7 @@ def canonicalName(command):
def reply(msg, s):
"""Makes a reply to msg with the payload s"""
if ircutils.funkyArgument(s):
s = repr(s)
s = ircutils.safeArgument(s)
if ircutils.isChannel(msg.args[0]):
m = ircmsgs.privmsg(msg.args[0], '%s: %s' % (msg.nick, s))
else:
@ -265,8 +264,7 @@ class IrcObjectProxy:
if isinstance(self.irc, self.__class__):
self.irc.reply(msg, s)
else:
if ircutils.funkyArgument(s):
s = repr(s)
s = ircutils.safeArgument(s)
self.irc.queueMsg(reply(msg, s))
else:
self.args[self.counter] = s

View File

@ -161,8 +161,11 @@ def validArgument(s):
return '\r' not in s and '\n' not in s and '\x00' not in s
notFunky = string.printable+'\x02'
def funkyArgument(s):
return validArgument(s) and s.translate(string.ascii, notFunky) != ''
def safeArgument(s):
if validArgument(s) and s.translate(string.ascii, notFunky) == s:
return s
else:
return repr(s)
def reply(msg):
if isChannel(msg.args[0]):