equal
deleted
inserted
replaced
13 mod inroom; |
13 mod inroom; |
14 |
14 |
15 pub fn handle(server: &mut HWServer, token: usize, message: HWProtocolMessage) { |
15 pub fn handle(server: &mut HWServer, token: usize, message: HWProtocolMessage) { |
16 match message { |
16 match message { |
17 HWProtocolMessage::Ping => |
17 HWProtocolMessage::Ping => |
18 server.react(token, vec![SendMe(Pong)]), |
18 server.react(token, vec![Pong.send_self().action()]), |
19 HWProtocolMessage::Quit(Some(msg)) => |
19 HWProtocolMessage::Quit(Some(msg)) => |
20 server.react(token, vec![ByeClient("User quit: ".to_string() + &msg)]), |
20 server.react(token, vec![ByeClient("User quit: ".to_string() + &msg)]), |
21 HWProtocolMessage::Quit(None) => |
21 HWProtocolMessage::Quit(None) => |
22 server.react(token, vec![ByeClient("User quit".to_string())]), |
22 server.react(token, vec![ByeClient("User quit".to_string())]), |
23 HWProtocolMessage::Malformed => warn!("Malformed/unknown message"), |
23 HWProtocolMessage::Malformed => warn!("Malformed/unknown message"), |