only log once per message
This commit is contained in:
parent
422f640c61
commit
e5c8b122b3
|
@ -10,9 +10,6 @@ use tokio::{
|
|||
};
|
||||
use uuid::Uuid;
|
||||
|
||||
// TODO:
|
||||
// * track nicknames
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
enum BroadcastMessage {
|
||||
MSG(String, String, String),
|
||||
|
@ -95,6 +92,8 @@ async fn connection_handler(
|
|||
(prefix, parts)
|
||||
};
|
||||
|
||||
tracing::info!("sender: {}, prefix: {}, arguments: {:#?}", nick, prefix, arguments.join(" "));
|
||||
|
||||
match prefix.as_str() {
|
||||
"MSG" => {
|
||||
if arguments.len() < 1 {
|
||||
|
@ -146,13 +145,11 @@ async fn connection_handler(
|
|||
match msg {
|
||||
BroadcastMessage::MSG(nick, msg, sender) => {
|
||||
if sender != id {
|
||||
tracing::info!("{}: {:?}", nick, msg);
|
||||
tx.write_all(format!("{} MSG {}\n", nick, msg).as_bytes()).await?;
|
||||
}
|
||||
},
|
||||
BroadcastMessage::NICK(old_nick, new_nick, sender) => {
|
||||
if sender != id {
|
||||
tracing::info!("{} changed to {}", old_nick, new_nick);
|
||||
tx.write_all(format!("{} NICK {}\n", old_nick, new_nick).as_bytes()).await?;
|
||||
}
|
||||
},
|
||||
|
@ -178,7 +175,6 @@ async fn connection_handler(
|
|||
ClientMessage::LIST(list) => {
|
||||
let names = list.join(" ");
|
||||
|
||||
tracing::info!("LIST: {}", names);
|
||||
tx.write_all(format!("LIST {}\n", names).as_bytes()).await?;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue