ircv3: close server-support-table gaps — BOT=B ISUPPORT, account-extban (a: matcher + ACCOUNTEXTBAN=a), draft/read-marker cap (gates MARKREAD sync), and no-implicit-names (suppress the post-JOIN NAMES burst)
This commit is contained in:
parent
c9bd8e7492
commit
bcd958d2d3
6 changed files with 75 additions and 5 deletions
16
src/modules/accountban.rs
Normal file
16
src/modules/accountban.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
//! The `a:` matching extban (IRCv3 account-extban): match a user by the services
|
||||
//! account they are logged into. `+b a:spammer` bans the account `spammer` (glob),
|
||||
//! `+e a:trusted` exempts one. A user with no account never matches. Dispatched
|
||||
//! from the channel ban matcher; advertised via `ACCOUNTEXTBAN=a`.
|
||||
|
||||
use crate::channels::glob_match;
|
||||
use crate::server::Server;
|
||||
use crate::Uid;
|
||||
|
||||
/// Does `uid`'s logged-in account match the glob `mask` (the part after `a:`)?
|
||||
pub fn matches(s: &Server, uid: Uid, mask: &str) -> bool {
|
||||
match s.users.get(&uid).and_then(|u| u.account.as_deref()) {
|
||||
Some(acct) => glob_match(mask, acct),
|
||||
None => false, // not logged in — an account ban can't match
|
||||
}
|
||||
}
|
||||
|
|
@ -140,11 +140,14 @@ impl Command for MarkReadCmd {
|
|||
.or_default()
|
||||
.insert(tkey, ts);
|
||||
let line = format!(":{} MARKREAD {target} timestamp={}", s.name, iso_time(ts));
|
||||
// Sync the new marker to every connection under this identity that
|
||||
// negotiated draft/read-marker (multi-device); others never asked
|
||||
// for read-marker traffic.
|
||||
let recips: Vec<Uid> = s
|
||||
.users
|
||||
.keys()
|
||||
.copied()
|
||||
.filter(|&p| marker_id(s, p) == id)
|
||||
.iter()
|
||||
.filter(|(&p, u)| u.caps.read_marker && marker_id(s, p) == id)
|
||||
.map(|(&p, _)| p)
|
||||
.collect();
|
||||
for p in recips {
|
||||
s.send(p, line.clone());
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
//! self-contained unit.
|
||||
|
||||
pub mod account_registration;
|
||||
pub mod accountban;
|
||||
pub mod antimixedutf8;
|
||||
pub mod antirandom;
|
||||
pub mod autodrop;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue