Fix IRC listener relay of bodies and modes, and JOIN names (closes #127)
check / check (push) Canceled after 0s

The IRC listener relayed only the first line of a PRIVMSG or NOTICE
body; it now sends one line per body line. A MODE change reached IRC
listener members without its key, limit or mask, and "+o bob" went out
as one trailing parameter; each value is now its own parameter, in the
relay and in the echo to the IRC listener user who made the change.
Every line written to an IRC listener connection now has CR, LF and NUL
removed, so a stored body line, key or mask cannot start a line of its
own. The channel name check moved from the HTTP handler into
service.JoinChannel, so the IRC listener's JOIN refuses the same names
with 403.

Model: opus-5-5
This commit is contained in:
2026-10-20 09:53:39 +00:00
committed by sneak
parent 7c6f0bc01e
commit 802c0d3c99
8 changed files with 287 additions and 45 deletions
+9 -1
View File
@@ -297,11 +297,19 @@ func (c *Conn) send(line string) {
}
// sendWithin writes a formatted IRC line to the connection,
// giving up after timeout.
// giving up after timeout. CR, LF and NUL are removed first:
// stored text can hold them, and on the wire they would end
// the line early. They are removed, not replaced with a
// space, because the line is already formatted and a space
// would split a parameter in two.
func (c *Conn) sendWithin(
timeout time.Duration,
line string,
) {
line = strings.ReplaceAll(line, "\r", "")
line = strings.ReplaceAll(line, "\n", "")
line = strings.ReplaceAll(line, "\x00", "")
c.writeMu.Lock()
defer c.writeMu.Unlock()