info command feature

This commit is contained in:
Mitchell 2020-06-20 15:29:31 +01:00
parent 5a7e27f010
commit 5ca8dd48f7
2 changed files with 16 additions and 0 deletions

View File

@ -44,7 +44,12 @@ impl Commands{
pub fn execute(&self, mut stream: &TcpStream, buffer: &mut [u8; 1024], data: &Vec<String>, address: &String, clients_ref: &Arc<Mutex<HashMap<String,Client>>>, message_queue: &Arc<FairMutex<VecDeque<String>>>){
match *self{
Commands::Info => {
let server_details = info::get_server_info();
let mut message = "!success: ".to_string();
message.push_str(&server_details.to_string());
network::transmit_data(stream, &message);
},
Commands::Success => {
},

View File

@ -0,0 +1,11 @@
pub fn get_server_info() -> String{
let mut server_details = "".to_string();
let server_name = String::from("Server-01");
let server_owner = String::from("mickyb18");
server_details.push_str(&server_name.to_string());
server_details.push_str(&" ".to_string());
server_details.push_str(&server_owner.to_string());
server_details
}