services: add server-level uline/is_service flag and gate the service WHOIS line, echo/services tag, MAP/LINKS hide and SVS* on it

This commit is contained in:
Jean Chevronnet 2026-08-16 13:43:17 +00:00
parent 64d3bfc003
commit d012623dff
4 changed files with 165 additions and 15 deletions

View file

@ -304,7 +304,14 @@ impl Command for Map {
RPL_MAP,
&format!("{} ({} users)", s.name, s.users.len()),
);
let mut peers: Vec<String> = s.servers.values().map(|sv| sv.name.clone()).collect();
// hideservices: services (U-lined) servers are hidden from non-opers.
let hide_svc = s.conf_bool("hideservices", false) && !s.is_oper(uid);
let mut peers: Vec<String> = s
.servers
.values()
.filter(|sv| !(hide_svc && sv.is_service))
.map(|sv| sv.name.clone())
.collect();
peers.sort();
for name in peers {
s.numeric(uid, RPL_MAP, &format!("`- {name}"));

View file

@ -76,9 +76,12 @@ impl Command for Links {
RPL_LINKS,
&format!("{} {} :0 {}", s.name, s.name, s.server_desc),
);
// hideservices: services (U-lined) servers are hidden from non-opers.
let hide_svc = s.conf_bool("hideservices", false) && !s.is_oper(uid);
let mut rows: Vec<(String, String)> = s
.servers
.values()
.filter(|sv| !(hide_svc && sv.is_service))
.map(|sv| (sv.name.clone(), sv.desc.clone()))
.collect();
rows.sort();
@ -123,6 +126,15 @@ impl Command for Whois {
RPL_WHOISSERVER,
&format!("{} {srv} :remote user", ru.nick),
);
// 313: a user on a U-lined services server is "a network service"
// (InspIRCd reworks the oper line the same way for services).
if s.server_is_service(&ru.sid) {
s.numeric(
uid,
RPL_WHOISOPERATOR,
&format!("{} :is a network service", ru.nick),
);
}
if let Some(a) = &ru.account {
s.numeric(
uid,