chanserv: topic, invite, akick, list, status

Adds the remaining moderation and listing commands. Auto-kick masks are
stored in the event log and enforced on join: a matching user is banned
and kicked. Topic and invite are sourced from the ChanServ pseudoclient.
This commit is contained in:
Jean Chevronnet 2026-07-12 11:30:07 +00:00
parent acd0e60946
commit ba3803e01c
No known key found for this signature in database
11 changed files with 369 additions and 7 deletions

View file

@ -0,0 +1,26 @@
use crate::engine::db::Db;
use crate::engine::service::{Sender, ServiceCtx};
use crate::engine::state::Network;
// INVITE <#channel> [nick]: invite a user (self if no nick) into the channel.
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, net: &Network, db: &Db) {
let Some(&chan) = args.get(1) else {
ctx.notice(me, from.uid, "Syntax: INVITE <#channel> [nick]");
return;
};
if !super::require_op(me, from, chan, ctx, db) {
return;
}
let target = match args.get(2) {
Some(&nick) => match net.uid_by_nick(nick) {
Some(u) => u.to_string(),
None => {
ctx.notice(me, from.uid, format!("\x02{nick}\x02 isn't here."));
return;
}
},
None => from.uid.to_string(),
};
ctx.invite(me, &target, chan);
ctx.notice(me, from.uid, format!("Invited to \x02{chan}\x02."));
}