Handle non-negotiated cap

This commit is contained in:
Mikhail 2024-05-30 20:12:50 +02:00
parent a3e41ad11d
commit ae0464b742
1 changed files with 36 additions and 27 deletions

View File

@ -27,8 +27,11 @@ use proto_irc::server::{AwayStatus, ServerMessage, ServerMessageBody};
use proto_irc::user::PrefixedNick;
use proto_irc::{Chan, Recipient, Tag};
use sasl::AuthBody;
mod cap;
use handler::Handler;
mod whois;
use crate::cap::Capabilities;
@ -861,6 +864,7 @@ async fn handle_incoming_message(
return Ok(HandleResult::Leave);
}
ClientMessage::ChatHistory { chan, limit } => {
if user.enabled_capabilities.contains(Capabilities::ChatHistory) {
let channel_name = match chan.clone() {
Chan::Global(chan) => chan,
Chan::Local(chan) => chan,
@ -890,6 +894,11 @@ async fn handle_incoming_message(
.await?;
}
writer.flush().await?;
} else {
log::warn!(
"Requested chat history for user {user:?} even though the capability was not negotiated"
);
}
}
}
cmd => {