Send nickname list in one command

parent 730b5664
......@@ -160,6 +160,7 @@ class RequestHandler(AsyncBase, asyncore.dispatcher):
>>> class DummyServer(object):
... def __init__(self): self.log = None
... def change_username(self, addr, username): pass
... def send_all(self, msg, sender): pass
>>> req = RequestHandler(None, None, None, DummyServer())
>>> assert req.parse_response('CHAT')
>>> assert req.parse_response('USER foo')
......@@ -189,11 +190,9 @@ class RequestHandler(AsyncBase, asyncore.dispatcher):
if cmd == 'SAY':
return self.send_all('SAY %s/%s' % (self.username, buf[4:]))
if cmd == 'NAMES':
self.send_raw('+Ok:')
clients = self.server.clients
for c in clients:
self.send_raw(clients[c].username)
self.send_raw('')
self.send_raw('+Ok:\r\n' \
+ '\r\n'.join([clients[c].username for c in clients]))
return True
return self.send_negative('Unsupported command.')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment