chanserv: SET SIGNKICK and PRIVATE (typed channel settings)

Introduce a typed ChanSettings struct + ChanSetting enum for ChanServ's on/off
options instead of a bag of string flags, so a new option is one field and the
compiler proves every site handles it. First two, both functional: SIGNKICK
attributes ChanServ kicks with who requested them; PRIVATE hides the channel
from LIST. Folded through the event log like the other channel state (node-local,
no gossip), shown in INFO. One ChannelSettingsSet event, one Store method.
This commit is contained in:
Jean Chevronnet 2026-07-13 02:54:46 +00:00
parent f388e3d650
commit 75019c867a
No known key found for this signature in database
7 changed files with 114 additions and 10 deletions

View file

@ -291,6 +291,16 @@ pub struct ChannelView {
pub akick: Vec<ChanAkickView>,
pub desc: String,
pub entrymsg: String,
// ChanServ SET options.
pub signkick: bool,
pub private: bool,
}
// A single ChanServ SET option, named for the typed `set_channel_setting` call.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ChanSetting {
SignKick,
Private,
}
impl ChannelView {
@ -405,6 +415,7 @@ pub trait Store {
fn drop_channel(&mut self, name: &str) -> Result<(), ChanError>;
fn set_mlock(&mut self, name: &str, on: &str, off: &str) -> Result<(), ChanError>;
fn set_desc(&mut self, channel: &str, desc: &str) -> Result<(), ChanError>;
fn set_channel_setting(&mut self, channel: &str, setting: ChanSetting, on: bool) -> Result<(), ChanError>;
fn set_entrymsg(&mut self, channel: &str, msg: &str) -> Result<(), ChanError>;
fn set_founder(&mut self, channel: &str, account: &str) -> Result<(), ChanError>;
fn access_add(&mut self, channel: &str, account: &str, level: &str) -> Result<(), ChanError>;