Rebrand the daemon and workspace: the binary is now `echo`, every crate is `echo-*` (`echo-api` and the module crates), Rust imports use `echo_*`, the gRPC proto is `proto/echo.proto` with package `echo.v1`, and the log filter, gossip peer-name default, and on-disk store default (`echo.db.jsonl`) follow. Docs updated throughout. No behaviour change; crate directories and the config schema are untouched.
20 lines
643 B
Rust
20 lines
643 B
Rust
use echo_api::{Sender, ServiceCtx, Store};
|
|
|
|
// LIST: operators see every group; others see the ones they belong to.
|
|
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
|
let names = if from.privs.any() {
|
|
db.groups()
|
|
} else if let Some(acc) = from.account {
|
|
db.groups_of(acc)
|
|
} else {
|
|
Vec::new()
|
|
};
|
|
if names.is_empty() {
|
|
ctx.notice(me, from.uid, "No groups to show.");
|
|
return;
|
|
}
|
|
for n in &names {
|
|
ctx.notice(me, from.uid, format!(" \x02{n}\x02"));
|
|
}
|
|
ctx.notice(me, from.uid, format!("End of list ({} group(s)).", names.len()));
|
|
}
|