bin/ircd: clip nicks with length more than MAXIMUM_LENGTH_OF_NICKNAME instead of skipping their msgs

This commit is contained in:
Dastan-glitch
2022-07-10 23:41:01 +00:00
parent b64f3f379d
commit 51e67a0e0c

View File

@@ -61,9 +61,10 @@ impl ProtocolPrivmsg {
loop {
let msg = self.msg_sub.receive().await?;
let mut msg = (*msg).to_owned();
if msg.nickname.len() > MAXIMUM_LENGTH_OF_NICKNAME {
continue
msg.nickname = msg.nickname[..MAXIMUM_LENGTH_OF_NICKNAME].to_string();
}
if self.msg_ids.lock().await.contains(&msg.id) {
@@ -71,14 +72,13 @@ impl ProtocolPrivmsg {
}
self.msg_ids.lock().await.push(msg.id);
let msg = (*msg).clone();
// add the msg to the buffer
self.msgs.lock().await.push(msg.clone());
self.notify_queue_sender.send(msg.clone()).await?;
self.p2p.broadcast_with_exclude(msg.clone(), &exclude_list).await?;
self.p2p.broadcast_with_exclude(msg, &exclude_list).await?;
}
}
}