echo/modules/hostserv/src/list.rs
Jean 993f5b2eea
Rename the project to Echo (was fedserv)
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.
2026-07-14 15:24:41 +00:00

18 lines
690 B
Rust

use echo_api::{Sender, ServiceCtx, Store};
// LIST: every account with an assigned vhost. Operators only.
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &dyn Store) {
if !super::require_oper(me, from, ctx) {
return;
}
let vhosts = db.vhosts();
if vhosts.is_empty() {
ctx.notice(me, from.uid, "No vhosts have been assigned.");
return;
}
ctx.notice(me, from.uid, format!("Assigned vhosts ({}):", vhosts.len()));
for v in &vhosts {
let temp = if v.expires.is_some() { ", temporary" } else { "" };
ctx.notice(me, from.uid, format!(" \x02{}\x02{} (by {}{temp})", v.account, v.host, v.setter));
}
}