🏡 index : ~doyle/titanirc.git

author Jordan Doyle <jordan@doyle.la> 2023-02-02 0:21:49.0 +00:00:00
committer Jordan Doyle <jordan@doyle.la> 2023-02-02 0:21:49.0 +00:00:00
commit
31fec73724b24c6f6a19170e8014ccde1306d5d9 [patch]
tree
358742242e52f314d82d26bf02e4992150781fd4
parent
524a15ea38e64b60889950c2dee41b7d3f42dd5e
download
31fec73724b24c6f6a19170e8014ccde1306d5d9.tar.gz

Implement TIME command



Diff

 src/client.rs | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/client.rs b/src/client.rs
index 540390c..60665d0 100644
--- a/src/client.rs
+++ a/src/client.rs
@@ -612,7 +612,23 @@
            }
            Command::STATS(_, _) => {}
            Command::LINKS(_, _) => {}
            Command::TIME(_) => {}
            Command::TIME(_) => {
                let time = chrono::Utc::now();

                self.writer.write(Message {
                    tags: None,
                    prefix: Some(Prefix::ServerName(SERVER_NAME.to_string())),
                    command: Command::Response(
                        Response::RPL_TIME,
                        vec![
                            self.connection.nick.to_string(),
                            SERVER_NAME.to_string(),
                            time.timestamp().to_string(),
                            time.format("%a %b %d %Y %T").to_string(),
                        ],
                    ),
                });
            }
            Command::CONNECT(_, _, _) => {}
            Command::TRACE(_) => {}
            Command::ADMIN(_) => {}