echo/modules/nickserv/src/getemail.rs
Jean 53d3d63464
All checks were successful
CI / check (push) Successful in 3m51s
NickServ GETEMAIL + ChanServ SET RESTRICTED
GETEMAIL (auspex) lists accounts whose email matches a glob. SET
RESTRICTED makes a channel kick anyone without access (or oper) as they
join, mirroring the SECUREOPS on-join enforcement.
2026-07-15 19:25:41 +00:00

19 lines
830 B
Rust

use echo_api::{Priv, Sender, ServiceCtx, Store};
// GETEMAIL <email>: list accounts registered with a matching email. Oper-only.
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: &dyn Store) {
if !from.privs.has(Priv::Auspex) {
ctx.notice(me, from.uid, "Access denied — GETEMAIL needs the \x02auspex\x02 privilege.");
return;
}
let Some(&pattern) = args.get(1) else {
ctx.notice(me, from.uid, "Syntax: GETEMAIL <email>");
return;
};
let accounts = db.accounts_by_email(pattern);
if accounts.is_empty() {
ctx.notice(me, from.uid, format!("No accounts use an email matching \x02{pattern}\x02."));
return;
}
ctx.notice(me, from.uid, format!("Accounts with email matching \x02{pattern}\x02: {}", accounts.join(", ")));
}