modules: move all per-module state/config out of server.rs/config.rs into own files
This commit is contained in:
parent
0d4c9297b5
commit
131471e245
18 changed files with 525 additions and 425 deletions
26
src/modules/hidewhois.rs
Normal file
26
src/modules/hidewhois.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
//! hidewhois — InspIRCd `m_hidewhois`. Hides sensitive WHOIS lines (server, idle,
|
||||
//! secure, …) from ordinary users. Opers and the user themselves are exempt when
|
||||
//! the matching config toggle is on. All config-driven; nothing lives on `Server`.
|
||||
|
||||
use crate::server::Server;
|
||||
use crate::Uid;
|
||||
|
||||
/// Whether sensitive WHOIS lines should be hidden for this (viewer, target) pair.
|
||||
pub fn hide(s: &Server, viewer: Uid, target: Uid, viewer_oper: bool) -> bool {
|
||||
if !s.conf_bool("hidewhois", false) {
|
||||
return false;
|
||||
}
|
||||
let selfview = s.conf_bool("hidewhois_selfview", true);
|
||||
let opers = s.conf_bool("hidewhois_opers", true);
|
||||
!(viewer == target && selfview) && !(viewer_oper && opers)
|
||||
}
|
||||
|
||||
pub fn hide_server(s: &Server) -> bool {
|
||||
s.conf_bool("hidewhois_hide_server", true)
|
||||
}
|
||||
pub fn hide_idle(s: &Server) -> bool {
|
||||
s.conf_bool("hidewhois_hide_idle", true)
|
||||
}
|
||||
pub fn hide_secure(s: &Server) -> bool {
|
||||
s.conf_bool("hidewhois_hide_secure", true)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue