rust/hedgewars-server/src/handlers/common.rs
changeset 16031 e915ed28726e
parent 16030 8ba2b5007c29
child 16032 abea7f16a03b
equal deleted inserted replaced
16030:8ba2b5007c29 16031:e915ed28726e
   348 pub fn remove_client(server: &mut HwServer, response: &mut Response, msg: String) {
   348 pub fn remove_client(server: &mut HwServer, response: &mut Response, msg: String) {
   349     let client_id = response.client_id();
   349     let client_id = response.client_id();
   350     let client = server.client(client_id);
   350     let client = server.client(client_id);
   351     let nick = client.nick.clone();
   351     let nick = client.nick.clone();
   352 
   352 
   353     if let Some(mut room_control) = server.get_room_control(client_id) {
   353     if let Some((room_id, result)) = server
   354         let room_id = room_control.room().id;
   354         .get_room_control(client_id)
   355         let result = room_control.leave_room();
   355         .into_room()
       
   356         .map(|mut control| (control.room().id, control.leave_room()))
       
   357     {
   356         get_room_leave_result(server, server.room(room_id), &msg, result, response);
   358         get_room_leave_result(server, server.room(room_id), &msg, result, response);
   357     }
   359     }
   358 
   360 
   359     server.remove_client(client_id);
   361     server.remove_client(client_id);
   360 
   362