nickserv: split into one file per command

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.
This commit is contained in:
Jean Chevronnet 2026-07-12 14:05:59 +00:00
parent 921088bfca
commit 9d6cf3bb08
No known key found for this signature in database
5 changed files with 138 additions and 127 deletions

View file

@ -0,0 +1,17 @@
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(),
});
}