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.
23 lines
1.1 KiB
Rust
23 lines
1.1 KiB
Rust
use echo_api::{human_time, NetView, Priv, Sender, ServiceCtx};
|
|
|
|
// LOGSEARCH [pattern]: search the recent action log — every kick, kill, ban,
|
|
// registration/drop, akill, suspension, vhost, note, and so on. A bare id (as
|
|
// stamped into a kick reason, e.g. from `[#3F]`) or any word from the summary
|
|
// matches; no argument lists the most recent. Read-only, so any operator who can
|
|
// see hidden info (Priv::Auspex) may run it.
|
|
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, net: &dyn NetView) {
|
|
if !from.privs.has(Priv::Auspex) {
|
|
ctx.notice(me, from.uid, "Access denied — LOGSEARCH needs the \x02auspex\x02 privilege.");
|
|
return;
|
|
}
|
|
let pattern = args[1..].join(" ");
|
|
let hits = net.search_incidents(&pattern, 20);
|
|
if hits.is_empty() {
|
|
ctx.notice(me, from.uid, "No matching log entries.");
|
|
return;
|
|
}
|
|
for h in &hits {
|
|
ctx.notice(me, from.uid, format!("[\x02#{}\x02] {} — {}", h.id, human_time(h.ts), h.summary));
|
|
}
|
|
ctx.notice(me, from.uid, format!("End of results ({} shown, newest first — refine the search to narrow).", hits.len()));
|
|
}
|