opertypes: oper classes + types — reusable capability classes and named roles (WHOIS title, auto usermodes/snomasks/vhost + level on oper-up, per-type command enforcement via on_pre_command); ships 5 built-in (helpop/globop/admin/servadmin/netadmin); oper blocks gain type=<id>; a typeless oper keeps full access

This commit is contained in:
Jean Chevronnet 2026-08-20 10:05:11 +00:00
parent f3ce0e61ef
commit 01516d5fdc
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
6 changed files with 509 additions and 5 deletions

View file

@ -298,12 +298,20 @@ impl Command for Whois {
s.numeric(uid, RPL_WHOISCHANNELS, &format!("{nick} :{line}"));
}
}
// 313: is an IRC operator (hidden by +H unless the asker is an oper)
// 313: is a/an <oper type> (the type's title, else plain "IRC operator");
// hidden by +H unless the asker is an oper.
if oper && (!hideoper || asker_oper) {
let title = crate::modules::opertypes::title_of(s, tuid)
.unwrap_or_else(|| "IRC operator".to_string());
let article = if title.chars().next().is_some_and(|c| "aeiouAEIOU".contains(c)) {
"an"
} else {
"a"
};
s.numeric(
uid,
RPL_WHOISOPERATOR,
&format!("{nick} :is an IRC operator"),
&format!("{nick} :is {article} {title}"),
);
}
// 320: oper-set SWHOIS line. No redundant target-nick param — just the