Fixed request 4.2.2 in server
This commit is contained in:
parent
76c8ece29a
commit
ff88e2133d
@ -88,16 +88,13 @@ fn distribute_message(
|
|||||||
fn send_clients_name(to: &SocketAddr, lock: &mut MutexGuard<UserMap>) {
|
fn send_clients_name(to: &SocketAddr, lock: &mut MutexGuard<UserMap>) {
|
||||||
let mut clients = String::new();
|
let mut clients = String::new();
|
||||||
for (client, entry) in (*lock).iter() {
|
for (client, entry) in (*lock).iter() {
|
||||||
&entry.0.trim_left();
|
|
||||||
&entry.0.trim_right();
|
|
||||||
clients.push_str(&format!(
|
clients.push_str(&format!(
|
||||||
"{}{} ",
|
"{}{} ",
|
||||||
if client == to { "(You)" } else { "" },
|
&entry.0.trim(),
|
||||||
&entry.0
|
if client == to { "(you)" } else { "" }
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
clients.trim_left();
|
let clients = clients.trim();
|
||||||
println!("{}", clients);
|
|
||||||
for (client, entry) in (*lock).iter() {
|
for (client, entry) in (*lock).iter() {
|
||||||
if client == to {
|
if client == to {
|
||||||
let stream = &entry.1;
|
let stream = &entry.1;
|
||||||
|
Loading…
Reference in New Issue
Block a user