equal
deleted
inserted
replaced
1 use mio; |
|
2 |
|
3 use server::server::HWServer; |
|
4 use server::actions::Action; |
|
5 use server::actions::Action::*; |
|
6 use protocol::messages::HWProtocolMessage; |
|
7 use protocol::messages::HWServerMessage::*; |
|
8 |
|
9 pub fn handle(server: & mut HWServer, token: usize, message: HWProtocolMessage) { |
|
10 match message { |
|
11 HWProtocolMessage::Nick(nick) => |
|
12 if server.clients[token].room_id == None { |
|
13 server.react(token, vec![SendMe(Nick(nick.clone()))]); |
|
14 server.clients[token].nick = nick; |
|
15 server.react(token, vec![CheckRegistered]); |
|
16 }, |
|
17 HWProtocolMessage::Proto(proto) => { |
|
18 server.clients[token].protocol_number = proto; |
|
19 server.react(token, vec![CheckRegistered]); |
|
20 }, |
|
21 _ => warn!("Incorrect command in logging-in state"), |
|
22 } |
|
23 } |
|