Services no longer receive the concrete account store. on_command now takes &mut dyn Store + &dyn NetView (both defined in fedserv-api); the engine's Db and Network implement them. Reads hand back plain views (AccountView, ChannelView, ...) carrying only non-secret fields, so the event log, gossip, and credential material (password hash, SCRAM verifiers) are unreachable from a module. All command modules ported; behaviour unchanged.
17 lines
669 B
Rust
17 lines
669 B
Rust
use crate::engine::db::Store;
|
|
use crate::engine::service::{Sender, ServiceCtx};
|
|
|
|
// GLIST: list the nicks grouped to your account.
|
|
pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, db: &dyn Store) {
|
|
let Some(account) = from.account else {
|
|
ctx.notice(me, from.uid, "You need to be logged in. Identify to NickServ first.");
|
|
return;
|
|
};
|
|
let mut nicks = db.grouped_nicks(account);
|
|
nicks.sort();
|
|
ctx.notice(me, from.uid, format!("Nicks grouped to \x02{account}\x02:"));
|
|
ctx.notice(me, from.uid, format!(" \x02{account}\x02 (main)"));
|
|
for n in nicks {
|
|
ctx.notice(me, from.uid, format!(" \x02{n}\x02"));
|
|
}
|
|
}
|