HostServ: ident@host vhosts (CHGIDENT)

A vhost may be ident@host, not just host: apply_vhost splits it and sends
CHGIDENT for the ident plus CHGHOST for the host. valid_vhost validates
the optional ident part; ON/SET/ACTIVATE/identify all route through
apply_vhost, so a bare host still works unchanged. New SetIdent action.
This commit is contained in:
Jean Chevronnet 2026-07-13 22:04:16 +00:00
parent 1edf250952
commit 898461d1c2
No known key found for this signature in database
8 changed files with 65 additions and 8 deletions

View file

@ -66,6 +66,8 @@ pub enum NetAction {
ForceNick { uid: String, nick: String },
// Set a user's displayed host (a vhost), or restore it.
SetHost { uid: String, host: String },
// Set a user's displayed ident/username (the `ident@` part of a vhost).
SetIdent { uid: String, ident: String },
// Force a user into a channel (SVSJOIN), e.g. applying an account's auto-join
// list on identify. `key` is empty for keyless channels.
ForceJoin { uid: String, channel: String, key: String },
@ -265,6 +267,18 @@ impl ServiceCtx {
});
}
// Apply a vhost spec to a user: `ident@host` sets both the ident and host,
// a bare `host` just the host.
pub fn apply_vhost(&mut self, uid: &str, spec: &str) {
match spec.split_once('@') {
Some((ident, host)) => {
self.actions.push(NetAction::SetIdent { uid: uid.to_string(), ident: ident.to_string() });
self.set_host(uid, host);
}
None => self.set_host(uid, spec),
}
}
// Force a user into a channel (SVSJOIN), e.g. an account's auto-join list.
pub fn force_join(&mut self, uid: &str, channel: &str, key: &str) {
self.actions.push(NetAction::ForceJoin {