whois: add 307 (is a registered nick) for identified users and 379 (is using modes) for opers/self
This commit is contained in:
parent
35af95fd0f
commit
309201d7fb
2 changed files with 24 additions and 0 deletions
|
|
@ -124,6 +124,11 @@ impl Command for Whois {
|
||||||
&format!("{} {srv} :remote user", ru.nick),
|
&format!("{} {srv} :remote user", ru.nick),
|
||||||
);
|
);
|
||||||
if let Some(a) = &ru.account {
|
if let Some(a) = &ru.account {
|
||||||
|
s.numeric(
|
||||||
|
uid,
|
||||||
|
RPL_WHOISREGNICK,
|
||||||
|
&format!("{} :is a registered nick", ru.nick),
|
||||||
|
);
|
||||||
s.numeric(
|
s.numeric(
|
||||||
uid,
|
uid,
|
||||||
RPL_WHOISACCOUNT,
|
RPL_WHOISACCOUNT,
|
||||||
|
|
@ -279,6 +284,23 @@ impl Command for Whois {
|
||||||
&format!("{nick} :is connecting from {ident}@{realhost} {realip}"),
|
&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
|
// 330: logged in to a services account
|
||||||
if let Some(acct) = &account {
|
if let Some(acct) = &account {
|
||||||
s.numeric(
|
s.numeric(
|
||||||
|
|
|
||||||
|
|
@ -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_WHOISOPERATOR: u16 = 313; // "is an IRC operator" (hidden by +H)
|
||||||
pub const RPL_WHOISBOT: u16 = 335; // "is a bot" (umode +B)
|
pub const RPL_WHOISBOT: u16 = 335; // "is a bot" (umode +B)
|
||||||
pub const RPL_WHOISACCOUNT: u16 = 330; // "<nick> <account> :is logged in as"
|
pub const RPL_WHOISACCOUNT: u16 = 330; // "<nick> <account> :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 +<umodes>"
|
||||||
pub const ERR_NEEDREGGEDNICK: u16 = 477; // chan +R/+M — must be logged into an account
|
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_WHOISHOST: u16 = 378; // oper-only: real host/ip behind a cloak
|
||||||
pub const RPL_WHOISSECURE: u16 = 671; // "is using a secure connection" (sslinfo)
|
pub const RPL_WHOISSECURE: u16 = 671; // "is using a secure connection" (sslinfo)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue