Merge branch 'channel-structure' of https://github.com/mitch161/rust-chat-server into channel-structure
This commit is contained in:
commit
0903a07cc0
|
|
@ -75,11 +75,7 @@ impl<'a> Client<'a> {
|
|||
match command {
|
||||
|
||||
Commands::Info(Some(params)) => {
|
||||
self.get_stream().write_all(a.to_string().as_bytes());
|
||||
/* why not do this?
|
||||
*
|
||||
* self.transmit_data(a.to_string().as_str());
|
||||
*/
|
||||
self.transmit_data(a.to_string().as_str());
|
||||
},
|
||||
Commands::Disconnect(None) => {
|
||||
|
||||
|
|
@ -87,10 +83,17 @@ impl<'a> Client<'a> {
|
|||
Commands::ClientRemove(Some(params)) => {},
|
||||
Commands::Client(Some(params)) => {
|
||||
self.transmit_data(a.to_string().as_str());
|
||||
todo!()
|
||||
/*
|
||||
* a success message needs to be read and confirmed
|
||||
*/
|
||||
|
||||
let command = Commands::from(&buffer);
|
||||
match command{
|
||||
Commands::Success(None) => {
|
||||
println!("sucess confirmed");
|
||||
},
|
||||
_ => {
|
||||
let error = Commands::Error(None);
|
||||
self.transmit_data(error.to_string().as_str());
|
||||
},
|
||||
}
|
||||
},
|
||||
Commands::Success(data) => {},
|
||||
_ => {},
|
||||
|
|
|
|||
|
|
@ -70,6 +70,11 @@ impl<'server_lifetime> Server<'server_lifetime> {
|
|||
self.thread_pool.execute(move || {
|
||||
client.handle_connection();
|
||||
});
|
||||
|
||||
let params: HashMap<String, String> = [(String::from("name"), username.clone()), (String::from("host"), address.clone()), (String::from("uuid"), uuid.clone())];
|
||||
let new_client = Commands::Client(Some(params));
|
||||
|
||||
self.update_all_clients(new_client);
|
||||
},
|
||||
Commands::Info(None) => {
|
||||
let mut params: HashMap<String, String> = HashMap::new();
|
||||
|
|
|
|||
Loading…
Reference in New Issue