extban: add r: realnameban, j: channelban, s: serverban matching extbans

This commit is contained in:
Jean Chevronnet 2026-08-09 11:30:53 +00:00
parent a48b48e46f
commit 245d8d8529
6 changed files with 96 additions and 3 deletions

20
src/modules/serverban.rs Normal file
View file

@ -0,0 +1,20 @@
//! serverban — the `s:` matching extban: match a user by the name of the server
//! they are connected to. `+b s:irc.example.net` bans everyone on that server.
//! Ban matching only ever runs against local users (join happens locally), so a
//! matched user is on this server — we glob the mask against our own name.
//! Dispatched from the channel ban matcher; the logic lives here.
//!
//! Behaviour reference: InspIRCd's `m_serverban`. Original native Rust.
use crate::channels::glob_match;
use crate::server::Server;
use crate::Uid;
/// Does `uid`'s server name match the glob `mask` (the part after `s:`)?
pub fn matches(s: &Server, uid: Uid, mask: &str) -> bool {
// local users are on this server; guard on the user still existing
if !s.users.contains_key(&uid) {
return false;
}
glob_match(mask, &s.name)
}