Skip to content

Commit

Permalink
Fix LINKS syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
progval authored and spb committed Dec 26, 2024
1 parent 034c4d5 commit baed3ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
20 changes: 13 additions & 7 deletions sable_ircd/src/command/handlers/links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ use sable_network::prelude::wrapper::ObjectWrapper;
#[command_handler("LINKS")]
fn handle_links(
response: &dyn CommandResponse,
server: &ClientServer,
local_server: &ClientServer,
net: &Network,
source: UserSource,
) -> CommandResult {
server.policy().can_list_links(&source)?;
local_server.policy().can_list_links(&source)?;

for server in net.servers() {
let server_info = format!(
for remote_server in net.servers() {
let remote_server_info = format!(
"last_ping={}, version={}",
server.last_ping(),
server.raw().version
remote_server.last_ping(),
remote_server.raw().version
);
response.numeric(make_numeric!(Links, server.name(), 0, &server_info));
response.numeric(make_numeric!(
Links,
remote_server.name(),
local_server.name(),
0,
&remote_server_info
));
}

response.numeric(make_numeric!(EndOfLinks));
Expand Down
4 changes: 2 additions & 2 deletions sable_ircd/src/messages/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ define_messages! {
=> "{chname} {user} {host} * {nick} {status} :{hopcount} {realname}" },
353(NamesReply) => { (is_pub: char, chan: &Channel.name(), content: &str)
=> "{is_pub} {chan} :{content}" },
364(Links) => { (server_name: &ServerName, hopcount: u64, server_info: &str)
=> "* {server_name} :{hopcount} {server_info}" },
364(Links) => { (remote_server_name: &ServerName, local_server_name: &ServerName, hopcount: u64, remote_server_info: &str)
=> "{remote_server_name} {local_server_name} :{hopcount} {remote_server_info}" },
365(EndOfLinks) => { () => "* :End of /LINKS list" },
366(EndOfNames) => { (chname: &str) => "{chname} :End of names list" },

Expand Down

0 comments on commit baed3ef

Please sign in to comment.