OperServ: MODE override and KICK

Two channel operator tools:

- MODE <#chan> <modes> [params] forces a channel mode change (TS 1, so it
  applies regardless of the current TS). A status-mode target may be given
  as a nick — it's resolved to the uid the ircd's FMODE expects.
- KICK <#chan> <nick> [reason] removes a user, sourced from OperServ and
  attributed to the operator.

Both admin-gated. To resolve status-mode params, channel-mode parameter
arity became one shared helper (chanmode_takes_param + STATUS_MODES in the
api): the ircd module now delegates to it instead of keeping its own copy,
so burst-parsing and MODE-building can never drift.
This commit is contained in:
Jean Chevronnet 2026-07-14 00:54:29 +00:00
parent 930198b826
commit c5d93f29c1
No known key found for this signature in database
6 changed files with 147 additions and 11 deletions

View file

@ -343,16 +343,9 @@ impl Protocol for InspIrcd {
}
}
// Whether a channel mode consumes a parameter, for standard InspIRCd chanmodes.
// List and prefix modes take one on both set and unset; the key takes one on
// both; the rest that take one do so only on set.
fn takes_param(m: char, adding: bool) -> bool {
match m {
'b' | 'e' | 'I' | 'q' | 'a' | 'o' | 'h' | 'v' | 'k' => true,
'l' | 'L' | 'f' | 'j' | 'J' | 'F' | 'H' => adding,
_ => false,
}
}
// Whether a channel mode consumes a parameter — the shared canonical arity, so
// parsing here and MODE-building in services never drift.
use fedserv_api::chanmode_takes_param as takes_param;
// Walk a mode change and its params for a key (+k/-k). Returns Some(Some(key))
// when a key is set, Some(None) when cleared, None when `k` isn't in the change.