Skip to content

Commit

Permalink
Implement unknown command
Browse files Browse the repository at this point in the history
  • Loading branch information
w4 committed Jan 29, 2024
1 parent c9bea1a commit 26f9b99
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,6 @@ impl StreamHandler<Result<irc_proto::Message, ProtocolError>> for Client {
),
});
}
Command::STATS(_, _) => {}
Command::LINKS(_, _) => {}
Command::TIME(_) => {
let time = chrono::Utc::now();

Expand All @@ -708,8 +706,6 @@ impl StreamHandler<Result<irc_proto::Message, ProtocolError>> for Client {
),
});
}
Command::CONNECT(_, _, _) => {}
Command::TRACE(_) => {}
Command::ADMIN(_) => {}
Command::INFO(_) => {}
Command::SERVLIST(_, _) => {}
Expand All @@ -728,16 +724,13 @@ impl StreamHandler<Result<irc_proto::Message, ProtocolError>> for Client {
Command::PONG(_, _) => {
self.last_active = Instant::now();
}
Command::ERROR(_) => {}
Command::AWAY(_) => {}
Command::REHASH => {}
Command::DIE => {}
Command::RESTART => {}
Command::SUMMON(_, _, _) => {}
Command::USERS(_) => {}
Command::WALLOPS(_) => {}
Command::USERHOST(_) => {}
Command::ISON(_) => {}
Command::SAJOIN(_, _) => {}
Command::SAMODE(_, _, _) => {}
Command::SANICK(old_nick, new_nick) => {
Expand Down Expand Up @@ -767,7 +760,21 @@ impl StreamHandler<Result<irc_proto::Message, ProtocolError>> for Client {
Command::BATCH(_, _, _) => {}
Command::CHGHOST(_, _) => {}
Command::Response(_, _) => {}
Command::Raw(_, _) => {}
v @ _ => self.writer.write(Message {

Check warning on line 763 in src/client.rs

View workflow job for this annotation

GitHub Actions / Clippy

the `v @ _` pattern can be written as just `v`
tags: None,
prefix: Some(Prefix::new_from_str(&self.connection.nick)),
command: Command::Response(
Response::ERR_UNKNOWNCOMMAND,
vec![
String::from(&v)
.split_whitespace()
.next()
.unwrap_or_default()
.to_string(),
"Unknown command".to_string(),
],
),
}),
}
}
}
Expand Down

0 comments on commit 26f9b99

Please sign in to comment.