chanserv: support param mode locks (+f flood, +j joinflood)
Some checks failed
CI / check (push) Has been cancelled

Mode locks were char-only, so Anope FLOOD/JOINFLOOD locks were dropped on
migration. Carry a value per locked param-mode through the event log, MLOCK
parsing/display, drift enforcement, compaction, and the Anope importer, so a
migrated network keeps its flood protection verbatim.
This commit is contained in:
Jean Chevronnet 2026-07-16 15:23:09 +00:00
parent 3f97a66dbb
commit 9d94dd5eb0
No known key found for this signature in database
9 changed files with 168 additions and 26 deletions

View file

@ -752,6 +752,9 @@ pub struct ChannelView {
// Mode-lock: chars services keep set / unset (besides the implicit +r).
pub lock_on: String,
pub lock_off: String,
// Param values for locked param-modes (+f flood, +j joinflood), in the order
// their mode chars appear in `lock_on`.
pub lock_params: Vec<(char, String)>,
pub access: Vec<ChanAccessView>,
pub akick: Vec<ChanAkickView>,
pub desc: String,
@ -856,6 +859,13 @@ impl ChannelView {
s.push('-');
s.push_str(&self.lock_off);
}
// Param modes take their argument as a trailing token, in mode-char order.
for ch in self.lock_on.chars() {
if let Some((_, param)) = self.lock_params.iter().find(|(c, _)| *c == ch) {
s.push(' ');
s.push_str(param);
}
}
s
}
@ -1059,7 +1069,7 @@ pub trait Store {
fn session_exceptions(&self) -> Vec<(String, u32, String)>;
fn register_channel(&mut self, name: &str, founder: &str) -> Result<(), ChanError>;
fn drop_channel(&mut self, name: &str) -> Result<(), ChanError>;
fn set_mlock(&mut self, name: &str, on: &str, off: &str) -> Result<(), ChanError>;
fn set_mlock(&mut self, name: &str, on: &str, off: &str, params: Vec<(char, String)>) -> Result<(), ChanError>;
fn set_desc(&mut self, channel: &str, desc: &str) -> Result<(), ChanError>;
fn set_url(&mut self, channel: &str, url: &str) -> Result<(), ChanError>;
fn set_channel_email(&mut self, channel: &str, email: &str) -> Result<(), ChanError>;