diff -r 6dea1ca64992 -r 18240b308505 rust/hedgewars-server/src/server/handlers/lobby.rs --- a/rust/hedgewars-server/src/server/handlers/lobby.rs Thu Apr 11 19:30:22 2019 +0300 +++ b/rust/hedgewars-server/src/server/handlers/lobby.rs Thu Apr 11 21:20:41 2019 +0300 @@ -3,7 +3,8 @@ use super::common::rnd_reply; use crate::{ protocol::messages::{ - add_flags, remove_flags, HWProtocolMessage, HWServerMessage::*, ProtocolFlags as Flags, + add_flags, remove_flags, server_chat, HWProtocolMessage, HWServerMessage::*, + ProtocolFlags as Flags, }, server::{ client::HWClient, @@ -13,6 +14,7 @@ utils::is_name_illegal, }; use log::*; +use std::{collections::HashSet, convert::identity}; pub fn handle( server: &mut HWServer, @@ -130,6 +132,31 @@ Rnd(v) => { response.add(rnd_reply(&v).send_self()); } + Stats => { + let mut protocols: HashSet<_> = server + .clients + .iter() + .map(|(_, c)| c.protocol_number) + .chain(server.rooms.iter().map(|(_, r)| r.protocol_number)) + .collect(); + let mut protocols: Vec<_> = protocols.drain().collect(); + protocols.sort(); + + let mut html = Vec::with_capacity(protocols.len() + 2); + + html.push("
{} | {} | {} |