whois: 313 shows the generic 'is an IRC Operator' again — the oper type gates capabilities, and a custom title comes from the SWHOIS line (320)

This commit is contained in:
Jean Chevronnet 2026-08-20 14:05:46 +00:00
parent 5a9825ee61
commit 8f9e60c8e2
No known key found for this signature in database
GPG key ID: 439666D63A9477E4

View file

@ -298,20 +298,14 @@ impl Command for Whois {
s.numeric(uid, RPL_WHOISCHANNELS, &format!("{nick} :{line}")); s.numeric(uid, RPL_WHOISCHANNELS, &format!("{nick} :{line}"));
} }
} }
// 313: is a/an <oper type> (the type's title, else plain "IRC operator"); // 313: is an IRC Operator (hidden by +H unless the asker is an oper). The
// hidden by +H unless the asker is an oper. // oper type sets capabilities, not this line — a custom title (e.g. "is a
// Network Administrator") comes from the SWHOIS line (320) instead.
if oper && (!hideoper || asker_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( s.numeric(
uid, uid,
RPL_WHOISOPERATOR, RPL_WHOISOPERATOR,
&format!("{nick} :is {article} {title}"), &format!("{nick} :is an IRC Operator"),
); );
} }
// 320: oper-set SWHOIS line. No redundant target-nick param — just the // 320: oper-set SWHOIS line. No redundant target-nick param — just the