All checks were successful
CI / check (push) Successful in 3m46s
UPDATE re-applies your auto-joins and vhost and re-checks for waiting memos without re-identifying. LIST (auspex-gated) shows registered accounts matching a glob, capped at 100. Adds an accounts_matching store method.
21 lines
873 B
Rust
21 lines
873 B
Rust
use echo_api::{Sender, ServiceCtx, Store};
|
|
|
|
// UPDATE: re-apply your account's auto-joins and vhost, and re-check for waiting
|
|
// memos, without having to re-identify.
|
|
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;
|
|
};
|
|
for entry in db.ajoin_list(account) {
|
|
ctx.force_join(from.uid, &entry.channel, &entry.key);
|
|
}
|
|
if let Some(v) = db.vhost(account) {
|
|
ctx.apply_vhost(from.uid, &v.host);
|
|
}
|
|
let unread = db.unread_memos(account);
|
|
if unread > 0 {
|
|
ctx.notice(me, from.uid, format!("You have \x02{unread}\x02 new memo(s). Read them with \x02/msg MemoServ READ NEW\x02."));
|
|
}
|
|
ctx.notice(me, from.uid, "Your status has been refreshed.");
|
|
}
|