Handle cap correctly and test

This commit is contained in:
Mikhail 2024-05-31 00:22:34 +02:00
parent dfc28148e5
commit ba26e833e4
2 changed files with 11 additions and 5 deletions

View File

@ -894,11 +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"
);
}
} else {
log::warn!(
"Requested chat history for user {user:?} even though the capability was not negotiated"
);
}
}
cmd => {

View File

@ -200,9 +200,14 @@ async fn scenario_basic_with_chathistory() -> Result<()> {
let mut stream = TcpStream::connect(server.server.addr).await?;
let mut s = TestScope::new(&mut stream);
s.send("PASS password").await?;
s.send("NICK tester").await?;
s.send("CAP REQ :draft/chathistory").await?;
s.send("USER UserName 0 * :Real Name").await?;
s.send("PASS password").await?;
s.send("USER UserName 0 * :Real Name").await?;
s.expect(":testserver CAP tester ACK :draft/chathistory").await?;
s.send("CAP END").await?;
s.expect_server_introduction("tester").await?;
s.expect_nothing().await?;
@ -211,6 +216,7 @@ async fn scenario_basic_with_chathistory() -> Result<()> {
s.expect(":testserver 332 tester #test :New room").await?;
s.expect(":testserver 353 tester = #test :tester").await?;
s.expect(":testserver 366 tester #test :End of /NAMES list").await?;
s.send("PRIVMSG #test :Message1").await?;
s.send("PRIVMSG #test :Message2").await?;
s.send("PRIVMSG #test :Message3").await?;