Split GroupServ into one file per command

REGISTER/DROP/INFO/LIST/ADD/DEL/FLAGS each move to their own file; the
two shared guards (login check, can-manage) stay in lib.rs beside the
dispatcher. No behaviour change.
This commit is contained in:
Jean Chevronnet 2026-07-14 14:43:18 +00:00
parent feba6700cb
commit 1916e5fce5
No known key found for this signature in database
8 changed files with 207 additions and 179 deletions

View file

@ -0,0 +1,16 @@
use fedserv_api::{Sender, ServiceCtx, Store};
// INFO <!group>: show a group's founder and member count.
pub fn handle(me: &str, from: &Sender, name: Option<&str>, ctx: &mut ServiceCtx, db: &mut dyn Store) {
let Some(name) = name else {
ctx.notice(me, from.uid, "Syntax: INFO <!group>");
return;
};
let Some(g) = db.group(name) else {
ctx.notice(me, from.uid, format!("\x02{name}\x02 isn't registered."));
return;
};
ctx.notice(me, from.uid, format!("Information for \x02{}\x02:", g.name));
ctx.notice(me, from.uid, format!(" Founder : \x02{}\x02", g.founder));
ctx.notice(me, from.uid, format!(" Members : {}", g.members.len()));
}