Skip to content
Snippets Groups Projects
Commit 0394c4c8 authored by Sander Mathijs van Veen's avatar Sander Mathijs van Veen
Browse files

Send nickname list in one command

parent 730b5664
No related branches found
No related tags found
No related merge requests found
...@@ -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.')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment