From 3230cdd9dbf560a39cc13d7efb801c86131e59b1 Mon Sep 17 00:00:00 2001 From: Jean Date: Sat, 18 Jul 2026 03:24:58 +0000 Subject: [PATCH] protocol: handle SQUERY like PRIVMSG so the NS/CS/OS/... service aliases work (proto 1206 delivers SQUERY raw instead of folding it to PRIVMSG) --- modules/protocol/inspircd/src/lib.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/protocol/inspircd/src/lib.rs b/modules/protocol/inspircd/src/lib.rs index edb54ff..333da5c 100644 --- a/modules/protocol/inspircd/src/lib.rs +++ b/modules/protocol/inspircd/src/lib.rs @@ -105,7 +105,11 @@ impl Protocol for InspIrcd { _ => vec![], } } - "PRIVMSG" => { + // PRIVMSG and SQUERY both deliver a message to a service. SQUERY (the + // form the NS/CS/… aliases use) is a 1206 command routed unicast to the + // services server; since we advertise 1206 the ircd sends it raw rather + // than folding it to PRIVMSG, so we must treat it the same. + "PRIVMSG" | "SQUERY" => { let to = tokens.next().unwrap_or("").to_string(); vec![NetEvent::Privmsg { from: source.unwrap_or_default(), @@ -727,6 +731,15 @@ mod tests { assert!(matches!(p.parse("CAPAB END").as_slice(), [NetEvent::CapabEnd])); } + // SQUERY (what the NS/CS aliases use on proto 1206) is delivered to a service + // just like a PRIVMSG, so it must surface the same event. + #[test] + fn squery_is_handled_like_privmsg() { + let mut p = proto(); + assert!(matches!(p.parse(":0IRAAAAAB SQUERY 42SAAAAAB :HELP").as_slice(), + [NetEvent::Privmsg { from, to, text }] if from == "0IRAAAAAB" && to == "42SAAAAAB" && text == "HELP")); + } + // CAPAB CAPABILITIES surfaces CASEMAPPING (echo verifies it's ascii). #[test] fn parses_capab_casemapping() {