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:
parent
feba6700cb
commit
1916e5fce5
8 changed files with 207 additions and 179 deletions
16
modules/groupserv/src/info.rs
Normal file
16
modules/groupserv/src/info.rs
Normal 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()));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue