opers: use the priv-name constants at the auspex checks; remove unused fns

This commit is contained in:
Jean Chevronnet 2026-08-30 03:28:15 +00:00
parent 369e06ec2b
commit a922a30bf1
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
6 changed files with 6 additions and 31 deletions

View file

@ -99,7 +99,7 @@ impl Command for List {
}
fn handle(&self, s: &mut Server, uid: Uid, _params: &[String]) -> CmdResult {
s.numeric(uid, RPL_LISTSTART, "Channel :Users Name");
let auspex = crate::modules::opertypes::has_priv(s, uid, "channels/auspex");
let auspex = crate::modules::opertypes::has_priv(s, uid, crate::modules::opertypes::privs::CHANNELS_AUSPEX);
let keys: Vec<String> = s.channels.keys().cloned().collect();
for key in keys {
let ch = &s.channels[&key];

View file

@ -178,8 +178,8 @@ impl Command for Whois {
};
let asker_oper = s.is_oper(uid);
// auspex: see through user privacy (real host+IP, geo) / channel privacy (secret chans)
let asker_auspex_u = crate::modules::opertypes::has_priv(s, uid, "users/auspex");
let asker_auspex_c = crate::modules::opertypes::has_priv(s, uid, "channels/auspex");
let asker_auspex_u = crate::modules::opertypes::has_priv(s, uid, crate::modules::opertypes::privs::USERS_AUSPEX);
let asker_auspex_c = crate::modules::opertypes::has_priv(s, uid, crate::modules::opertypes::privs::CHANNELS_AUSPEX);
let is_self = tuid == uid;
// hidewhois: hide sensitive lines from ordinary users (opers/self exempt per config)
let hide = crate::modules::hidewhois::hide(s, uid, tuid, asker_oper);
@ -477,8 +477,8 @@ impl Command for Who {
let asker_oper = s.is_oper(uid);
// auspex: reveal secret/private channel members (channels/auspex) and +i users
// who share no channel with the asker (users/auspex)
let asker_auspex_u = crate::modules::opertypes::has_priv(s, uid, "users/auspex");
let asker_auspex_c = crate::modules::opertypes::has_priv(s, uid, "channels/auspex");
let asker_auspex_u = crate::modules::opertypes::has_priv(s, uid, crate::modules::opertypes::privs::USERS_AUSPEX);
let asker_auspex_c = crate::modules::opertypes::has_priv(s, uid, crate::modules::opertypes::privs::CHANNELS_AUSPEX);
let multi = s
.users
.get(&uid)

View file

@ -265,13 +265,6 @@ impl Server {
.is_some_and(|ru| self.server_is_service(&ru.sid))
}
/// Whether the user reachable by this nick is a network service.
pub fn nick_is_service(&self, nick: &str) -> bool {
self.remote_nick
.get(&nick.to_ascii_lowercase())
.is_some_and(|uuid| self.uuid_is_service(uuid))
}
fn link_server(&mut self, uid: Uid, msg: &Message) {
if msg.params.len() < 4 {
self.reject_link(uid, "Not enough SERVER parameters");

View file

@ -144,19 +144,6 @@ pub fn def_for_letter(c: char) -> Option<&'static PrefixDef> {
custom_defs().iter().find(|d| d.letter == c)
}
/// The prefix mode letter for a sigil char (FJOIN decode); `' '` if none.
pub fn letter_for_sigil(c: char) -> char {
let cs = c.to_string();
if let Some(i) = (0..6).find(|&i| sigil(i) == cs) {
return LETTERS[i];
}
custom_defs()
.iter()
.find(|d| d.sigil == cs)
.map(|d| d.letter)
.unwrap_or(' ')
}
fn builtin_index(letter: char) -> Option<usize> {
LETTERS.iter().position(|&l| l == letter)
}

View file

@ -116,11 +116,6 @@ impl Module for OperTypes {
}
}
/// The WHOIS title of a typed oper, if any (used in the denial message).
pub fn title_of(s: &Server, uid: Uid) -> Option<String> {
s.users.get(&uid).and_then(|u| u.ext.get::<OperType>()).map(|t| t.title.clone())
}
/// The formatted WHOIS special line for a typed oper, if any — "is a/an <title>",
/// bold + the type's colour (mIRC code, e.g. 4 = red) so it stands out. core_info
/// emits it on its own 320 line.

View file

@ -98,7 +98,7 @@ impl Module for Snoop {
let full = format!("{head}{ip_full}{port_seg}{trans}{geo_full}{tail}");
let redacted = format!("{head}{ip_red}{port_seg}{trans}{geo_red}{tail}");
srv.snotice_c_gated('c', &full, &redacted, |u| {
crate::modules::opertypes::user_has_priv(u, "users/auspex")
crate::modules::opertypes::user_has_priv(u, crate::modules::opertypes::privs::USERS_AUSPEX)
});
}
fn on_join(&mut self, srv: &mut Server, uid: Uid, chan: &str) {