--- a/rust/hedgewars-server/src/server/handlers/common.rs Mon Feb 04 19:22:21 2019 +0300
+++ b/rust/hedgewars-server/src/server/handlers/common.rs Mon Feb 04 20:25:35 2019 +0300
@@ -21,6 +21,15 @@
}
}
+pub fn remove_client(server: &mut HWServer, response: &mut super::Response, msg: String) {
+ use HWServerMessage::*;
+ let nick = server.clients[response.client_id()].nick.clone();
+ response.add(LobbyLeft(nick, msg.to_string()).send_all());
+ response.add(Bye("User quit: ".to_string() + &msg).send_self());
+
+ server.remove_client(response.client_id());
+}
+
#[cfg(test)]
mod tests {
use super::*;