Skip to content

Commit

Permalink
implement server-local VERSION response (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
A-UNDERSCORE-D authored Apr 15, 2024
1 parent 901b26b commit d369bf4
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions sable_ircd/src/command/handlers/version.rs
Original file line number Diff line number Diff line change
@@ -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(())
}
1 change: 1 addition & 0 deletions sable_ircd/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ mod handlers {
mod rename;
mod topic;
mod user;
mod version;
mod userhost;
mod who;
mod whois;
Expand Down
2 changes: 2 additions & 0 deletions sable_ircd/src/messages/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}" },
Expand Down
2 changes: 1 addition & 1 deletion sable_ircd/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub struct ClientServer {

auth_client: AuthClient,
myinfo: MyInfo,
isupport: ISupportBuilder,
pub isupport: ISupportBuilder,
client_caps: CapabilityRepository,

node: Arc<NetworkNode>,
Expand Down

0 comments on commit d369bf4

Please sign in to comment.