From 26f9b995091690eb9c9fd242ccd829632c1e74cd Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Mon, 29 Jan 2024 00:21:59 +0000 Subject: [PATCH] Implement unknown command --- src/client.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/client.rs b/src/client.rs index 118fc5e..90027f1 100644 --- a/src/client.rs +++ b/src/client.rs @@ -689,8 +689,6 @@ impl StreamHandler> for Client { ), }); } - Command::STATS(_, _) => {} - Command::LINKS(_, _) => {} Command::TIME(_) => { let time = chrono::Utc::now(); @@ -708,8 +706,6 @@ impl StreamHandler> for Client { ), }); } - Command::CONNECT(_, _, _) => {} - Command::TRACE(_) => {} Command::ADMIN(_) => {} Command::INFO(_) => {} Command::SERVLIST(_, _) => {} @@ -728,16 +724,13 @@ impl StreamHandler> 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) => { @@ -767,7 +760,21 @@ impl StreamHandler> for Client { Command::BATCH(_, _, _) => {} Command::CHGHOST(_, _) => {} Command::Response(_, _) => {} - Command::Raw(_, _) => {} + v @ _ => self.writer.write(Message { + 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(), + ], + ), + }), } } } -- libgit2 1.7.2