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,14 @@
use crate::engine::service::{Sender, ServiceCtx};
// LOGOUT: log out and rename to a guest nick (prefix + a per-logout sequence).
pub fn handle(me: &str, guest_nick: &str, guest_seq: &mut u32, from: &Sender, ctx: &mut ServiceCtx) {
if from.account.is_none() {
ctx.notice(me, from.uid, "You're not logged in.");
return;
}
let guest = format!("{guest_nick}{guest_seq}");
*guest_seq = guest_seq.wrapping_add(1);
ctx.logout(from.uid);
ctx.force_nick(from.uid, &guest);
ctx.notice(me, from.uid, format!("You're now logged out. Your nick is now \x02{}\x02.", guest));
}