Fix IRC listener relay of bodies and modes, and JOIN names (closes #127)
check / check (push) Canceled after 0s
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 relayed MODE change now carries its key, limit or mask, each value its own parameter, also in the echo to the user who made it. CR, LF and NUL are removed from each parameter and from each whole line sent to an IRC listener connection, so no stored value can start a line of its own. The channel name check moved into service.JoinChannel, so the IRC listener's JOIN refuses the same names with 403. Model: opus-5-5
This commit is contained in:
@@ -297,11 +297,17 @@ 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,
|
||||
// as FormatMessage does for each parameter, so that a line
|
||||
// built without it cannot end early either.
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user