OperServ: SNLINE realname bans

SNLINE ADD [+expiry] <realname-regex> <reason> / DEL / LIST — a realname
R-line the ircd matches against connecting users' realnames. It's just
another kind ("R") in the generalized X-line handler: same event-sourced
list, lazy expiry, and burst re-assertion as AKILL/SQLINE, keyed by
(kind, mask). The mask is kept verbatim (a single-token regex; use . or
\\s for spaces) and an all-wildcard pattern is refused. STATS now counts
it too.
This commit is contained in:
Jean Chevronnet 2026-07-14 01:36:08 +00:00
parent a67409e0d3
commit 78ad909706
No known key found for this signature in database
4 changed files with 17 additions and 2 deletions

View file

@ -1533,6 +1533,7 @@ impl Engine {
fn ban_kind_label(kind: &str) -> &'static str {
match kind {
"Q" => "nick ban",
"R" => "realname ban",
_ => "network ban",
}
}
@ -3987,6 +3988,8 @@ mod tests {
assert!(os(&mut e, "000AAAAAS", "SQLINE ADD a@b spam").iter().any(|a| matches!(a, NetAction::Notice { text, .. } if text.contains("valid"))), "nick mask rejects user@host");
// STATS reflects the live ban counts.
assert!(os(&mut e, "000AAAAAS", "STATS").iter().any(|a| matches!(a, NetAction::Notice { text, .. } if text.contains("1") && text.contains("SQLINE"))), "stats shows the sqline count");
// SNLINE drives a realname R-line.
assert!(os(&mut e, "000AAAAAS", "SNLINE ADD .*free.money.* spambot").iter().any(|a| matches!(a, NetAction::AddLine { kind, mask, .. } if kind == "R" && mask == ".*free.money.*")), "R-line added");
// GLOBAL fans out to every user via the $* server glob.
let out = os(&mut e, "000AAAAAS", "GLOBAL rebooting in 5");