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