From bddf13459d021f1b3b22eb3438ab77edbd08c619 Mon Sep 17 00:00:00 2001 From: Jean Date: Mon, 13 Jul 2026 19:15:40 +0000 Subject: [PATCH] Wire NickServ + ChanServ into the shared stats registry nickserv.identify / nickserv.identify_fail and chanserv.register / chanserv.drop are now recorded via ctx.count, so the Stats API reports each module's own events, not just BotServ's. --- chanserv/src/lib.rs | 2 ++ nickserv/src/identify.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/chanserv/src/lib.rs b/chanserv/src/lib.rs index 125853e..3abe569 100644 --- a/chanserv/src/lib.rs +++ b/chanserv/src/lib.rs @@ -84,6 +84,7 @@ impl Service for ChanServ { match db.register_channel(chan, account) { Ok(()) => { ctx.channel_mode(me, chan, "+r"); // mark the channel registered + ctx.count("chanserv.register"); ctx.notice(me, from.uid, format!("\x02{chan}\x02 is now registered and you are its founder. Enjoy!")); } Err(ChanError::Exists) => ctx.notice(me, from.uid, format!("\x02{chan}\x02 is already registered. Try \x02INFO {chan}\x02 to see who owns it.")), @@ -143,6 +144,7 @@ impl Service for ChanServ { match db.drop_channel(chan) { Ok(()) => { ctx.channel_mode(me, chan, "-r"); // no longer registered + ctx.count("chanserv.drop"); ctx.notice(me, from.uid, format!("\x02{chan}\x02 has been dropped and is no longer registered.")); } Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."), diff --git a/nickserv/src/identify.rs b/nickserv/src/identify.rs index ffbb0d6..69c50ba 100644 --- a/nickserv/src/identify.rs +++ b/nickserv/src/identify.rs @@ -53,6 +53,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: return; } ctx.login(from.uid, &account); + ctx.count("nickserv.identify"); ctx.notice(me, from.uid, format!("You're now identified as \x02{}\x02. Welcome back!", account)); // Apply the account's auto-join list (AJOIN). for entry in db.ajoin_list(&account) { @@ -66,6 +67,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db: } None => { db.note_auth(account_name, false); + ctx.count("nickserv.identify_fail"); ctx.notice(me, from.uid, "Invalid password. Please try again."); } }