Expand OperServ: SQLINE nick bans, GLOBAL, and KILL

Generalise the network-ban store to carry the ircd X-line kind (defaulted
to the user@host G-line for existing records) so one event-sourced,
lazily-expiring, burst-reasserted list backs every ban type, and drive
ADD/DEL/LIST from one implementation per kind:

- AKILL stays the user@host G-line; SQLINE is a nick Q-line, its mask
  validated as a nick glob (an @ is refused so an AKILL-shaped mask can't
  become an over-broad nick ban). Both are keyed by (kind, mask).
- GLOBAL <message> announces to every user via a $* server-glob notice.
- KILL <nick> [reason] disconnects a user, attributed to the operator.

All four are admin-gated, and OperServ itself stays invisible to non-opers.
Bans and kills go out as typed actions (AddLine/DelLine/KillUser) the ircd
link serialises to ADDLINE/DELLINE/KILL.
This commit is contained in:
Jean Chevronnet 2026-07-14 00:45:52 +00:00
parent 57e104e510
commit 930198b826
No known key found for this signature in database
9 changed files with 351 additions and 189 deletions

18
operserv/src/global.rs Normal file
View file

@ -0,0 +1,18 @@
use fedserv_api::{Priv, Sender, ServiceCtx};
// GLOBAL <message>: send an announcement to every user on the network. Admin-
// only — it reaches everyone, so it's the heaviest voice services have.
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx) {
if !from.privs.has(Priv::Admin) {
ctx.notice(me, from.uid, "Access denied — GLOBAL needs the \x02admin\x02 privilege.");
return;
}
let message = args[1..].join(" ");
if message.trim().is_empty() {
ctx.notice(me, from.uid, "Syntax: GLOBAL <message>");
return;
}
// A marker so users can tell an official announcement from a normal notice.
ctx.global(me, format!("[\x02Network\x02] {message}"));
ctx.notice(me, from.uid, "Your announcement has been sent to the whole network.");
}