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.
17 lines
880 B
Rust
17 lines
880 B
Rust
use echo_api::{human_time, Sender, ServiceCtx, Store};
|
|
|
|
// VIEW <id> (aka READ): operators read a report in full.
|
|
pub fn handle(me: &str, from: &Sender, id: Option<&str>, ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
|
if !super::require_oper(me, from, ctx) {
|
|
return;
|
|
}
|
|
let Some(r) = id.and_then(|n| n.parse::<u64>().ok()).and_then(|n| db.report(n)) else {
|
|
ctx.notice(me, from.uid, "No such report. Syntax: VIEW <id>");
|
|
return;
|
|
};
|
|
ctx.notice(me, from.uid, format!("Report \x02#{}\x02 ({}):", r.id, if r.open { "open" } else { "closed" }));
|
|
ctx.notice(me, from.uid, format!(" By : \x02{}\x02", r.reporter));
|
|
ctx.notice(me, from.uid, format!(" About : \x02{}\x02", r.target));
|
|
ctx.notice(me, from.uid, format!(" Filed : {}", human_time(r.ts)));
|
|
ctx.notice(me, from.uid, format!(" Reason : {}", r.reason));
|
|
}
|