Fixed request 4.2.2 in server and client
This commit is contained in:
parent
741dff0195
commit
c0e43b4a46
@ -12,7 +12,7 @@ use self::chrono::Local;
|
||||
|
||||
/*
|
||||
|
||||
0.1 [ ]
|
||||
0.1 [X]
|
||||
1.1 [X]
|
||||
1.2 [ ]
|
||||
1.3 [X]
|
||||
@ -29,7 +29,7 @@ use self::chrono::Local;
|
||||
4.1.1 [X]
|
||||
4.1.2 [X]
|
||||
4.2.1 [X]
|
||||
4.2.2 [-]
|
||||
4.2.2 [X]
|
||||
|
||||
*/
|
||||
|
||||
@ -259,6 +259,7 @@ fn exchange_with_server(stream: TcpStream) {
|
||||
}
|
||||
msg = String::new();
|
||||
#[allow(unused_assignments)]
|
||||
#[allow(unused_assignments)]
|
||||
i = i - 1;
|
||||
}
|
||||
}
|
||||
@ -296,8 +297,13 @@ fn exchange_with_server(stream: TcpStream) {
|
||||
return Ok("Ok");
|
||||
}
|
||||
"LIST" => {
|
||||
println!("{}", ">>>> LIST OF CLIENTS CONNECTED <<<<".bold().yellow());
|
||||
for i in 2..spliced_input.len() {
|
||||
println!(
|
||||
"{}{}{}",
|
||||
">>>> LIST OF CLIENTS CONNECTED (".bold().yellow(),
|
||||
spliced_input[2],
|
||||
") <<<<".bold().yellow()
|
||||
);
|
||||
for i in 3..spliced_input.len() {
|
||||
println!("\t\t{}", spliced_input[i]);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ use self::chrono::Local;
|
||||
4.1.1 [X]
|
||||
4.1.2 [X]
|
||||
4.2.1 [X]
|
||||
4.2.2 [-]
|
||||
4.2.2 [X]
|
||||
|
||||
*/
|
||||
|
||||
@ -100,7 +100,9 @@ fn distribute_message(
|
||||
|
||||
fn send_clients_name(to: &SocketAddr, lock: &mut MutexGuard<UserMap>) {
|
||||
let mut clients = String::new();
|
||||
let mut num_client = 0usize;
|
||||
for (client, entry) in (*lock).iter() {
|
||||
num_client += 1;
|
||||
clients.push_str(&format!(
|
||||
"{}{} ",
|
||||
&entry.0.trim(),
|
||||
@ -112,7 +114,7 @@ fn send_clients_name(to: &SocketAddr, lock: &mut MutexGuard<UserMap>) {
|
||||
if client == to {
|
||||
let stream = &entry.1;
|
||||
let mut writer = BufWriter::new(stream);
|
||||
let mut req = String::from("LIST CLIENTS ");
|
||||
let mut req = String::from(format!("{}{} ", "LIST CLIENTS ", num_client));
|
||||
req.push_str(clients);
|
||||
println!(
|
||||
"{time} to {nick}@{addr} : {message}",
|
||||
|
Loading…
Reference in New Issue
Block a user