Send nickname list in one command

parent 730b5664
...@@ -160,6 +160,7 @@ class RequestHandler(AsyncBase, asyncore.dispatcher): ...@@ -160,6 +160,7 @@ class RequestHandler(AsyncBase, asyncore.dispatcher):
>>> class DummyServer(object): >>> class DummyServer(object):
... def __init__(self): self.log = None ... def __init__(self): self.log = None
... def change_username(self, addr, username): pass ... def change_username(self, addr, username): pass
... def send_all(self, msg, sender): pass
>>> req = RequestHandler(None, None, None, DummyServer()) >>> req = RequestHandler(None, None, None, DummyServer())
>>> assert req.parse_response('CHAT') >>> assert req.parse_response('CHAT')
>>> assert req.parse_response('USER foo') >>> assert req.parse_response('USER foo')
...@@ -189,11 +190,9 @@ class RequestHandler(AsyncBase, asyncore.dispatcher): ...@@ -189,11 +190,9 @@ class RequestHandler(AsyncBase, asyncore.dispatcher):
if cmd == 'SAY': if cmd == 'SAY':
return self.send_all('SAY %s/%s' % (self.username, buf[4:])) return self.send_all('SAY %s/%s' % (self.username, buf[4:]))
if cmd == 'NAMES': if cmd == 'NAMES':
self.send_raw('+Ok:')
clients = self.server.clients clients = self.server.clients
for c in clients: self.send_raw('+Ok:\r\n' \
self.send_raw(clients[c].username) + '\r\n'.join([clients[c].username for c in clients]))
self.send_raw('')
return True return True
return self.send_negative('Unsupported command.') 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