Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
uva
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
uva
Commits
0394c4c8
Commit
0394c4c8
authored
Mar 10, 2011
by
Sander Mathijs van Veen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Send nickname list in one command
parent
730b5664
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
telematica/ass1/server.py
telematica/ass1/server.py
+3
-4
No files found.
telematica/ass1/server.py
View file @
0394c4c8
...
@@ -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.'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment