echo/modules/memoserv/src/info.rs
Jean 98ecbca414
All checks were successful
CI / check (push) Successful in 3m49s
MemoServ: add CANCEL, CHECK, and INFO
CANCEL recalls the sender's most recent unread memo to a target (one the
recipient already read can't be recalled); CHECK reports whether the last
memo you sent someone has been read; INFO summarises your mailbox. Adds
memo_cancel/memo_check store methods and shares MAX_MEMOS from the module
root instead of duplicating it in send.rs.
2026-07-15 18:09:33 +00:00

12 lines
469 B
Rust

use echo_api::{Sender, ServiceCtx, Store};
// INFO: a summary of your mailbox (total, unread, capacity).
pub fn handle(me: &str, from: &Sender, account: &str, ctx: &mut ServiceCtx, db: &mut dyn Store) {
let total = db.memo_list(account).len();
let unread = db.unread_memos(account);
ctx.notice(
me,
from.uid,
format!("You have \x02{total}\x02 memo(s), \x02{unread}\x02 unread, of a maximum \x02{}\x02.", super::MAX_MEMOS),
);
}