transparently handle newlines in message

--HG--
branch : nmdc-ircfrontend
This commit is contained in:
. 2016-05-03 19:57:55 +12:00
parent e97f344f00
commit 07f01a1d92

View File

@ -3,6 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"net" "net"
"strings"
"time" "time"
) )
@ -101,8 +102,9 @@ func (c *Client) reply(code replyCode, args ...string) {
case rplKill: case rplKill:
c.write(fmt.Sprintf(":%s KILL %s A %s", args[0], c.nick, args[1])) c.write(fmt.Sprintf(":%s KILL %s A %s", args[0], c.nick, args[1]))
case rplMsg: case rplMsg:
// FIXME escape newlines in message!! for _, itm := range strings.Split(args[2], "\n") {
c.write(fmt.Sprintf(":%s PRIVMSG %s %s", args[0], args[1], args[2])) c.write(fmt.Sprintf(":%s PRIVMSG %s %s", args[0], args[1], itm))
}
case rplList: case rplList:
c.write(fmt.Sprintf(":%s 322 %s %s", c.server.name, c.nick, args[0])) c.write(fmt.Sprintf(":%s 322 %s %s", c.server.name, c.nick, args[0]))
case rplListEnd: case rplListEnd: