🏡 index : ~doyle/titanirc.git

author Jordan Doyle <jordan@doyle.la> 2024-01-29 0:21:59.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2024-01-29 0:21:59.0 +00:00:00
commit
26f9b995091690eb9c9fd242ccd829632c1e74cd [patch]
tree
8993a13346f9c13553810068f4d50b5d97143f15
parent
c9bea1a6103a9dd96a1f7e729f5bb8d0dabe6854
download
26f9b995091690eb9c9fd242ccd829632c1e74cd.tar.gz

Implement unknown command



Diff

 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<Result<irc_proto::Message, ProtocolError>> for Client {
                    ),
                });
            }
            Command::STATS(_, _) => {}
            Command::LINKS(_, _) => {}
            Command::TIME(_) => {
                let time = chrono::Utc::now();

@@ -708,8 +706,6 @@ impl StreamHandler<Result<irc_proto::Message, ProtocolError>> for Client {
                    ),
                });
            }
            Command::CONNECT(_, _, _) => {}
            Command::TRACE(_) => {}
            Command::ADMIN(_) => {}
            Command::INFO(_) => {}
            Command::SERVLIST(_, _) => {}
@@ -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) => {
@@ -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 {
                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(),
                    ],
                ),
            }),
        }
    }
}