From 309201d7fbfc9ea37775963826af262f8c312d49 Mon Sep 17 00:00:00 2001 From: reverse Date: Sat, 15 Aug 2026 16:46:10 +0000 Subject: [PATCH] whois: add 307 (is a registered nick) for identified users and 379 (is using modes) for opers/self --- src/coremods/core_info.rs | 22 ++++++++++++++++++++++ src/numeric.rs | 2 ++ 2 files changed, 24 insertions(+) diff --git a/src/coremods/core_info.rs b/src/coremods/core_info.rs index a0df437..6daf170 100644 --- a/src/coremods/core_info.rs +++ b/src/coremods/core_info.rs @@ -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( diff --git a/src/numeric.rs b/src/numeric.rs index a5cde31..eff56a5 100644 --- a/src/numeric.rs +++ b/src/numeric.rs @@ -96,6 +96,8 @@ pub const RPL_ENDOFWHOIS: u16 = 318; pub const RPL_WHOISOPERATOR: u16 = 313; // "is an IRC operator" (hidden by +H) pub const RPL_WHOISBOT: u16 = 335; // "is a bot" (umode +B) pub const RPL_WHOISACCOUNT: u16 = 330; // " :is logged in as" +pub const RPL_WHOISREGNICK: u16 = 307; // "is a registered nick" (identified to an account) +pub const RPL_WHOISMODES: u16 = 379; // oper/self-only: "is using modes +" pub const ERR_NEEDREGGEDNICK: u16 = 477; // chan +R/+M — must be logged into an account pub const RPL_WHOISHOST: u16 = 378; // oper-only: real host/ip behind a cloak pub const RPL_WHOISSECURE: u16 = 671; // "is using a secure connection" (sslinfo)