Restore the connect-time host when a session logs out, reversing any services vhost

This commit is contained in:
Jean Chevronnet 2026-07-20 20:39:03 +00:00
parent 66eb0ea243
commit 8b45d386c6
No known key found for this signature in database
5 changed files with 48 additions and 2 deletions

View file

@ -3,11 +3,12 @@ use echo_api::t;
// 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, net: &dyn NetView, db: &dyn Store) {
if from.account.is_none() {
let Some(account) = from.account else {
ctx.notice(me, from.uid, "You're not logged in.");
return;
}
};
let guest = echo_api::next_guest_nick(guest_nick, guest_seq, net, db);
ctx.actions.extend(echo_api::vhost_restore_actions(net, db, from.uid, account));
ctx.logout(from.uid);
ctx.force_nick(from.uid, &guest);
ctx.notice(me, from.uid, t!(ctx, "You're now logged out. Your nick is now \x02{guest}\x02.", guest = guest));