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:
parent
921088bfca
commit
9d6cf3bb08
5 changed files with 138 additions and 127 deletions
17
modules/nickserv/register.rs
Normal file
17
modules/nickserv/register.rs
Normal 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(),
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue