whois: add 307 (is a registered nick) for identified users and 379 (is using modes) for opers/self

This commit is contained in:
Jean Chevronnet 2026-08-15 16:46:10 +00:00
parent 35af95fd0f
commit 309201d7fb
2 changed files with 24 additions and 0 deletions

View file

@ -124,6 +124,11 @@ impl Command for Whois {
&format!("{} {srv} :remote user", ru.nick),
);
if let Some(a) = &ru.account {
s.numeric(
uid,
RPL_WHOISREGNICK,
&format!("{} :is a registered nick", ru.nick),
);
s.numeric(
uid,
RPL_WHOISACCOUNT,
@ -279,6 +284,23 @@ impl Command for Whois {
&format!("{nick} :is connecting from {ident}@{realhost} {realip}"),
);
}
// 307: identified to a registered account (carries the +r registered umode)
if account.is_some() {
s.numeric(
uid,
RPL_WHOISREGNICK,
&format!("{nick} :is a registered nick"),
);
}
// 379: the user's active modes — visible to opers and to the user themselves
if is_self || asker_oper {
let modes = s
.users
.get(&tuid)
.map(|u| u.flags.umodes())
.unwrap_or_default();
s.numeric(uid, RPL_WHOISMODES, &format!("{nick} :is using modes {modes}"));
}
// 330: logged in to a services account
if let Some(acct) = &account {
s.numeric(