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.
This commit is contained in:
parent
d4e2c905f2
commit
bddf13459d
2 changed files with 4 additions and 0 deletions
|
|
@ -84,6 +84,7 @@ impl Service for ChanServ {
|
||||||
match db.register_channel(chan, account) {
|
match db.register_channel(chan, account) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
ctx.channel_mode(me, chan, "+r"); // mark the channel registered
|
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!"));
|
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.")),
|
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) {
|
match db.drop_channel(chan) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
ctx.channel_mode(me, chan, "-r"); // no longer registered
|
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."));
|
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."),
|
Err(_) => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),
|
||||||
|
|
|
||||||
|
|
@ -53,6 +53,7 @@ pub fn handle(me: &str, from: &Sender, args: &[&str], ctx: &mut ServiceCtx, db:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ctx.login(from.uid, &account);
|
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));
|
ctx.notice(me, from.uid, format!("You're now identified as \x02{}\x02. Welcome back!", account));
|
||||||
// Apply the account's auto-join list (AJOIN).
|
// Apply the account's auto-join list (AJOIN).
|
||||||
for entry in db.ajoin_list(&account) {
|
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 => {
|
None => {
|
||||||
db.note_auth(account_name, false);
|
db.note_auth(account_name, false);
|
||||||
|
ctx.count("nickserv.identify_fail");
|
||||||
ctx.notice(me, from.uid, "Invalid password. Please try again.");
|
ctx.notice(me, from.uid, "Invalid password. Please try again.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue