Group the module crates under modules/
The service pseudo-clients and the ircd protocol link sat flat at the repo root, mixed in with the daemon core and the SDK. Move them all under modules/ so the tree separates concerns cleanly: the daemon in src/, the SDK every module links against in api/, and the loadable modules — the pseudo-clients plus the protocol link — in modules/. Workspace members, the daemon's per-crate dependency paths, and each module's api path are updated to match; the docs follow. No code change.
This commit is contained in:
parent
6f76f9722c
commit
ad2a623120
116 changed files with 69 additions and 46 deletions
|
|
@ -1,42 +0,0 @@
|
|||
use fedserv_api::{human_time, MemoView, Sender, ServiceCtx, Store};
|
||||
|
||||
// READ <num>|NEW|ALL: display memos and mark them read.
|
||||
pub fn handle(me: &str, from: &Sender, account: &str, args: &[&str], ctx: &mut ServiceCtx, db: &mut dyn Store) {
|
||||
match args.get(1).map(|s| s.to_ascii_uppercase()).as_deref() {
|
||||
Some("NEW") | Some("ALL") => {
|
||||
let only_new = args[1].eq_ignore_ascii_case("new");
|
||||
let targets: Vec<usize> = db
|
||||
.memo_list(account)
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, m)| !only_new || !m.read)
|
||||
.map(|(i, _)| i)
|
||||
.collect();
|
||||
if targets.is_empty() {
|
||||
ctx.notice(me, from.uid, if only_new { "You have no new memos." } else { "You have no memos." });
|
||||
return;
|
||||
}
|
||||
for i in targets {
|
||||
if let Some(m) = db.memo_read(account, i) {
|
||||
show(me, from, i, &m, ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(numstr) => {
|
||||
let Some(n) = numstr.parse::<usize>().ok().filter(|n| *n >= 1) else {
|
||||
ctx.notice(me, from.uid, "Syntax: READ <num>|NEW|ALL");
|
||||
return;
|
||||
};
|
||||
match db.memo_read(account, n - 1) {
|
||||
Some(m) => show(me, from, n - 1, &m, ctx),
|
||||
None => ctx.notice(me, from.uid, format!("You have no memo #\x02{n}\x02.")),
|
||||
}
|
||||
}
|
||||
None => ctx.notice(me, from.uid, "Syntax: READ <num>|NEW|ALL"),
|
||||
}
|
||||
}
|
||||
|
||||
fn show(me: &str, from: &Sender, index: usize, m: &MemoView, ctx: &mut ServiceCtx) {
|
||||
ctx.notice(me, from.uid, format!("Memo #\x02{}\x02 from \x02{}\x02 ({}):", index + 1, m.from, human_time(m.ts)));
|
||||
ctx.notice(me, from.uid, format!(" {}", m.text));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue