OperServ: add SVSPART
All checks were successful
CI / check (push) Successful in 3m36s

SVSPART <nick> <#channel> [reason] forces a user out of a channel
(admin-only), completing the SVS command family alongside SVSNICK and
SVSJOIN. New ForcePart action rendered as the ircd SVSPART command.
This commit is contained in:
Jean Chevronnet 2026-07-16 00:00:18 +00:00
parent 53d3d63464
commit ccbbb91fda
No known key found for this signature in database
5 changed files with 83 additions and 0 deletions

View file

@ -290,6 +290,14 @@ impl Protocol for InspIrcd {
}
// SVSJOIN <uid> <chan> [key]: force a user into a channel, sourced from
// the services server. Used to apply an account's auto-join list.
// SVSPART <uid> <chan> [:reason]: force a user out of a channel.
NetAction::ForcePart { uid, channel, reason } => {
if reason.is_empty() {
vec![self.sourced(format!("SVSPART {} {}", uid, channel))]
} else {
vec![self.sourced(format!("SVSPART {} {} :{}", uid, channel, reason))]
}
}
NetAction::ForceJoin { uid, channel, key } => {
if key.is_empty() {
vec![self.sourced(format!("SVSJOIN {} {}", uid, channel))]
@ -483,6 +491,14 @@ mod tests {
assert_eq!(lines, vec![":42S ENCAP 0IR CHGIDENT 0IRAAAAAB cool".to_string()]);
}
#[test]
fn serializes_svspart() {
let lines = proto().serialize(&NetAction::ForcePart { uid: "0IRAAAAAB".into(), channel: "#chan".into(), reason: "bye".into() });
assert_eq!(lines, vec![":42S SVSPART 0IRAAAAAB #chan :bye".to_string()]);
let lines = proto().serialize(&NetAction::ForcePart { uid: "0IRAAAAAB".into(), channel: "#chan".into(), reason: String::new() });
assert_eq!(lines, vec![":42S SVSPART 0IRAAAAAB #chan".to_string()]);
}
// Free-form text with embedded line breaks must not smuggle a second line
// onto the link: the serializer strips CR/LF/NUL from every outbound line.
#[test]