operserv: REDACT deletes a message by its msgid (draft/message-redaction), relayed server-sourced so no ircd oper privilege is needed
All checks were successful
CI / check (push) Successful in 4m6s

This commit is contained in:
Jean Chevronnet 2026-07-18 01:23:37 +00:00
parent e6f05a3ede
commit e206f4edbb
No known key found for this signature in database
4 changed files with 40 additions and 0 deletions

View file

@ -475,6 +475,11 @@ impl Protocol for InspIrcd {
}
NetAction::DelLine { kind, mask } => vec![self.sourced(format!("DELLINE {} {}", kind, mask))],
NetAction::KillUser { from, uid, reason } => vec![format!(":{} KILL {} :{}", from, uid, reason)],
NetAction::Redact { from, target, msgid, reason } => vec![if reason.is_empty() {
format!(":{from} REDACT {target} {msgid}")
} else {
format!(":{from} REDACT {target} {msgid} :{reason}")
}],
// Introduce a server behind us: :<our-sid> SERVER <name> <sid> :<desc>.
NetAction::JupeServer { name, sid, reason } => {
vec![self.sourced(format!("SERVER {} {} :JUPED: {}", name, sid, reason))]
@ -768,6 +773,14 @@ mod tests {
assert_eq!(lines, vec![":42S ENCAP 0IR CHGIDENT 0IRAAAAAB cool".to_string()]);
}
#[test]
fn serializes_redact() {
let with = proto().serialize(&NetAction::Redact { from: "42SAAAAAA".into(), target: "#c".into(), msgid: "abc".into(), reason: "spam".into() });
assert_eq!(with, vec![":42SAAAAAA REDACT #c abc :spam".to_string()]);
let without = proto().serialize(&NetAction::Redact { from: "42SAAAAAA".into(), target: "alice".into(), msgid: "xyz".into(), reason: String::new() });
assert_eq!(without, vec![":42SAAAAAA REDACT alice xyz".to_string()], "no trailing when reason is empty");
}
#[test]
fn serializes_svspart() {
let lines = proto().serialize(&NetAction::ForcePart { uid: "0IRAAAAAB".into(), channel: "#chan".into(), reason: "bye".into() });