equal
deleted
inserted
replaced
8 use protocol::messages::{ |
8 use protocol::messages::{ |
9 HWProtocolMessage, |
9 HWProtocolMessage, |
10 HWServerMessage::* |
10 HWServerMessage::* |
11 }; |
11 }; |
12 use utils::is_name_illegal; |
12 use utils::is_name_illegal; |
13 use super::common::rnd_reply; |
13 use super::common::rnd_action; |
14 |
14 |
15 pub fn handle(server: &mut HWServer, client_id: ClientId, message: HWProtocolMessage) { |
15 pub fn handle(server: &mut HWServer, client_id: ClientId, message: HWProtocolMessage) { |
16 use protocol::messages::HWProtocolMessage::*; |
16 use protocol::messages::HWProtocolMessage::*; |
17 match message { |
17 match message { |
18 CreateRoom(name, password) => { |
18 CreateRoom(name, password) => { |
56 vec![Warn("No such room.".to_string())] |
56 vec![Warn("No such room.".to_string())] |
57 }; |
57 }; |
58 } |
58 } |
59 server.react(client_id, actions); |
59 server.react(client_id, actions); |
60 }, |
60 }, |
61 Rnd(v) => server.react(client_id, rnd_reply(v)), |
61 Rnd(v) => { |
|
62 let actions = rnd_action(v, server.room(client_id)); |
|
63 server.react(client_id, actions) |
|
64 }, |
62 List => warn!("Deprecated LIST message received"), |
65 List => warn!("Deprecated LIST message received"), |
63 _ => warn!("Incorrect command in lobby state"), |
66 _ => warn!("Incorrect command in lobby state"), |
64 } |
67 } |
65 } |
68 } |