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.
This commit is contained in:
parent
959d085e7a
commit
21efbd32c1
6 changed files with 91 additions and 0 deletions
21
modules/nickserv/src/update.rs
Normal file
21
modules/nickserv/src/update.rs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
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.");
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue