diff --git a/sable_ircd/src/command/handlers/version.rs b/sable_ircd/src/command/handlers/version.rs new file mode 100644 index 00000000..544d5f77 --- /dev/null +++ b/sable_ircd/src/command/handlers/version.rs @@ -0,0 +1,16 @@ +use super::*; + +#[command_handler("VERSION")] +fn handle_version(server: &ClientServer, response: &dyn CommandResponse) -> CommandResult { + response.numeric(make_numeric!( + Version, + server.name(), + server.node().version() + )); + + for v in server.isupport.data().iter() { + response.numeric(make_numeric!(ISupport, v)) + } + + Ok(()) +} diff --git a/sable_ircd/src/command/mod.rs b/sable_ircd/src/command/mod.rs index bb76fb38..8f7c3452 100644 --- a/sable_ircd/src/command/mod.rs +++ b/sable_ircd/src/command/mod.rs @@ -63,6 +63,7 @@ mod handlers { mod rename; mod topic; mod user; + mod version; mod userhost; mod who; mod whois; diff --git a/sable_ircd/src/messages/numeric.rs b/sable_ircd/src/messages/numeric.rs index afba2976..627a6134 100644 --- a/sable_ircd/src/messages/numeric.rs +++ b/sable_ircd/src/messages/numeric.rs @@ -11,6 +11,8 @@ define_messages! { => "{server_name} {version} {user_modes} {chan_modes} {chan_modes_with_a_parameter}" }, 005(ISupport) => { (data: &str) => "{data} :are supported by this server" }, + 351(Version) => { (server_name: &ServerName, version: &str) => "{server_name} {version}: Sable IRCd"}, + 221(UserModeIs) => { (modestring: &str) => ":{modestring}" }, 301(Away) => { (nick: &User.nick(), reason: &AwayReason) => "{nick} :{reason}" }, 302(Userhost) => { (reply: &str) => ":{reply}" }, diff --git a/sable_ircd/src/server/mod.rs b/sable_ircd/src/server/mod.rs index d7b9425e..9de192f7 100644 --- a/sable_ircd/src/server/mod.rs +++ b/sable_ircd/src/server/mod.rs @@ -83,7 +83,7 @@ pub struct ClientServer { auth_client: AuthClient, myinfo: MyInfo, - isupport: ISupportBuilder, + pub isupport: ISupportBuilder, client_caps: CapabilityRepository, node: Arc,