Stamp a traceable incident id into every kick and kill

A single choke-point in handle() gives each outgoing Kick / KillUser a
short id, appends it to the reason the user sees ([#3F]), and records a
searchable summary in a bounded per-node incident ring on the live network
view. So a bot flood-kick, a fantasy kick, a votekick, and an operator
KICK are all logged the same way, and the id in a kick reason ties back to
the log entry. Exposed via NetView::search_incidents (id-exact or summary
substring, newest first) for the LOGSEARCH command to come.
This commit is contained in:
Jean Chevronnet 2026-07-14 02:09:45 +00:00
parent 1f7591778f
commit d2a8d0ef05
No known key found for this signature in database
3 changed files with 142 additions and 2 deletions

View file

@ -861,6 +861,19 @@ pub trait NetView {
// Session limiting: live sessions from an IP, and IPs at/over a threshold.
fn session_count(&self, ip: &str) -> u32;
fn sessions_over(&self, min: u32) -> Vec<(String, u32)>;
// Search the recent moderation/action incident log (newest first, capped at
// `limit`). An empty pattern returns the most recent; otherwise matches the
// id or a case-insensitive substring of the summary.
fn search_incidents(&self, pattern: &str, limit: usize) -> Vec<IncidentView>;
}
// One recorded action from the incident log: a short id (also stamped into the
// action's reason), when it happened, and a human summary.
#[derive(Debug, Clone)]
pub struct IncidentView {
pub id: String,
pub ts: u64,
pub summary: String,
}
// A pseudo-client (NickServ, ChanServ, ...). Introduced at burst, receives the