Mirrors the chanserv layout: nickserv.rs keeps the service and dispatch, each command (register, identify, logout, cert) lives in its own file with its subcommands and parameters. Behaviour is unchanged.
17 lines
672 B
Rust
17 lines
672 B
Rust
use crate::engine::service::{Sender, ServiceCtx};
|
|
use crate::proto::RegReply;
|
|
|
|
// REGISTER <password> [email]: register the sender's current nick. The engine
|
|
// derives the password off-thread, commits, and answers.
|
|
pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx) {
|
|
let Some(password) = args.get(1) else {
|
|
ctx.notice(me, from.uid, "Syntax: REGISTER <password> [email]");
|
|
return;
|
|
};
|
|
let email = args.get(2).map(|s| s.to_string());
|
|
ctx.defer_register(from.nick, *password, email, RegReply::NickServ {
|
|
agent: me.to_string(),
|
|
uid: from.uid.to_string(),
|
|
nick: from.nick.to_string(),
|
|
});
|
|
}
|