accounts: oper snotice on post-connect login ('Client X is now logged in as Y')

This commit is contained in:
Jean Chevronnet 2026-08-25 02:21:58 +00:00
parent 37436d0306
commit 935f22f2f2
No known key found for this signature in database
GPG key ID: 439666D63A9477E4
2 changed files with 44 additions and 2 deletions

View file

@ -26,11 +26,11 @@ impl Server {
/// Log `uid` into `account` (services-driven): sets the account name, flips
/// `+r`, and reflects the mode back to the user.
pub fn set_login(&mut self, uid: Uid, account: &str) {
let (nick, prefix) = match self.users.get_mut(&uid) {
let (nick, prefix, registered) = match self.users.get_mut(&uid) {
Some(u) => {
u.account = Some(account.to_string());
u.flags.logged_in = true;
(u.nick.clone(), u.prefix())
(u.nick.clone(), u.prefix(), u.registered)
}
None => return,
};
@ -39,6 +39,12 @@ impl Server {
self.notify_peers(uid, &format!(":{prefix} ACCOUNT {account}"), |c| {
c.account_notify
});
// Operator notice, but only for a login that happens AFTER the user is
// connected. A SASL-at-connect login runs before registration completes, so
// it's already reflected in the "Client connecting: … account: …" notice.
if registered {
self.snotice_c('c', &format!("Client {nick} is now logged in as {account}"));
}
}
/// Log `uid` out of any account (services-driven): clears `+r`.