snomasks: make +s a parametric snomask mode with the standard category letters (acdfgjklnoqrtuvwx), route each server notice by category, RPL_SNOMASKIS 008; opers default to all and narrow with +s -c etc.
This commit is contained in:
parent
309201d7fb
commit
546f6279e7
16 changed files with 131 additions and 29 deletions
|
|
@ -843,12 +843,19 @@ impl Server {
|
|||
}
|
||||
|
||||
/// Send a server notice to every operator who has snomask (+s) on.
|
||||
/// A server notice in the general `a` (announcement) category.
|
||||
pub fn snotice(&self, msg: &str) {
|
||||
self.snotice_c('a', msg);
|
||||
}
|
||||
|
||||
/// A server notice tagged with snomask category `cat` — only opers whose snomask
|
||||
/// (`+s`) subscribes to that letter receive it. Logging tees are unconditional.
|
||||
pub fn snotice_c(&self, cat: char, msg: &str) {
|
||||
self.log_push(msg);
|
||||
let opers: Vec<Uid> = self
|
||||
.users
|
||||
.iter()
|
||||
.filter(|(_, u)| u.flags.oper && u.flags.snomask)
|
||||
.filter(|(_, u)| u.flags.oper && u.flags.snomask_cats.contains(cat))
|
||||
.map(|(&u, _)| u)
|
||||
.collect();
|
||||
let jval = self.json_log_value(msg, &opers);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue