CBAN (forbid channel-name globs) + SSLINFO command
This commit is contained in:
parent
cab53016e8
commit
4a53c80d4d
5 changed files with 91 additions and 0 deletions
16
src/xline.rs
16
src/xline.rs
|
|
@ -15,6 +15,7 @@ pub enum XKind {
|
|||
Eline, // user@host / ip EXEMPT from K/G/Z-lines
|
||||
Shun, // user@host allowed to connect but whose commands are dropped
|
||||
Qline, // a reserved/forbidden nick glob
|
||||
Cban, // a forbidden channel-name glob
|
||||
}
|
||||
|
||||
impl XKind {
|
||||
|
|
@ -26,6 +27,7 @@ impl XKind {
|
|||
XKind::Eline => "E",
|
||||
XKind::Shun => "SHUN",
|
||||
XKind::Qline => "Q",
|
||||
XKind::Cban => "CBAN",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -109,6 +111,20 @@ impl Server {
|
|||
.map(|x| x.reason.clone())
|
||||
}
|
||||
|
||||
/// The reason channel `chan` is CBAN'd (forbidden), if any. Case-insensitive.
|
||||
pub fn matched_cban(&self, chan: &str) -> Option<String> {
|
||||
let n = now();
|
||||
let c = chan.to_ascii_lowercase();
|
||||
self.xlines
|
||||
.iter()
|
||||
.find(|x| {
|
||||
x.kind == XKind::Cban
|
||||
&& (x.expires == 0 || x.expires > n)
|
||||
&& glob_match(&x.mask.to_ascii_lowercase(), &c)
|
||||
})
|
||||
.map(|x| x.reason.clone())
|
||||
}
|
||||
|
||||
/// The reason a `user@host` / `ip` is banned by an active x-line, if any.
|
||||
/// An E-line (exemption) overrides every K/G/Z-line.
|
||||
pub fn matched_xline(&self, ident: &str, host: &str, ip: &str) -> Option<String> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue