Restore the real ident when a HostServ ident@host vhost is turned off or deleted

This commit is contained in:
Jean Chevronnet 2026-07-19 04:49:31 +00:00
parent 384f222a22
commit af5896743d
No known key found for this signature in database
4 changed files with 35 additions and 2 deletions

View file

@ -7,14 +7,22 @@ pub fn handle(me: &str, from: &Sender, ctx: &mut ServiceCtx, net: &dyn NetView,
ctx.notice(me, from.uid, "You need to identify to NickServ first.");
return;
};
if db.vhost(account).is_none() {
let Some(vhost) = db.vhost(account) else {
ctx.notice(me, from.uid, "You have no vhost assigned.");
return;
}
};
match net.host_of(from.uid) {
Some(host) => {
let host = host.to_string();
ctx.set_host(from.uid, &host);
// An `ident@host` vhost spoofed the ident too; restore the real one, or
// the user keeps the vhost's username for the rest of the session.
if vhost.host.contains('@') {
if let Some(ident) = net.ident_of(from.uid) {
let ident = ident.to_string();
ctx.set_ident(from.uid, &ident);
}
}
ctx.notice(me, from.uid, "Your vhost is off; your normal host is restored.");
}
None => ctx.notice(me, from.uid, "Sorry, that didn't work. Please try again in a moment."),