accounts: oper snotice on post-connect login ('Client X is now logged in as Y')
This commit is contained in:
parent
37436d0306
commit
935f22f2f2
2 changed files with 44 additions and 2 deletions
|
|
@ -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`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue