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
14
modules/nickserv/logout.rs
Normal file
14
modules/nickserv/logout.rs
Normal 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));
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue