From 31fec73724b24c6f6a19170e8014ccde1306d5d9 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Thu, 2 Feb 2023 00:21:49 +0000 Subject: [PATCH] Implement TIME command --- 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 +++ b/src/client.rs @@ -612,7 +612,23 @@ impl StreamHandler> for Client { } 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(_) => {} -- libgit2 1.7.2