Trying new syncmail, added Cmd class.

This commit is contained in:
Jeremy Fincher 2003-04-24 07:58:16 +00:00
parent 3620be1ed2
commit 0aa5ece16a

View File

@ -75,6 +75,31 @@ nicks += [msg.nick for msg in msgs if msg.nick]
def getMsgs(command):
return [msg for msg in msgs if msg.command == command]
class Cmd(object):
def __init__(self, command, *args):
self.args = (command,) + args
def toString(self, recursed=False):
if recursed:
return '[%s]' % ' '.join(map(utils.dqrepr, args))
else:
L = [conf.prefixChars[0]]
for arg in args:
if isinstance(arg, self.__class__):
L.append(utils.dqrepr(arg.toString(recursed=True)))
else:
L.append(utils.dqrepr(arg))
L.append(' ')
L.pop()
return ''.join(L)
def __str__(self):
return self.toString()
class PluginTestCase(unittest.TestCase):
callbacks = ()
channels = ()
if __name__ == '__main__':
world.testing = True