From 07f01a1d92df56272e9ace19fffb3ab426ec86c8 Mon Sep 17 00:00:00 2001 From: "." <.@.> Date: Tue, 3 May 2016 19:57:55 +1200 Subject: [PATCH] transparently handle newlines in message --HG-- branch : nmdc-ircfrontend --- client.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index b70d84b..293c7c1 100644 --- a/client.go +++ b/client.go @@ -3,6 +3,7 @@ package main import ( "fmt" "net" + "strings" "time" ) @@ -101,8 +102,9 @@ func (c *Client) reply(code replyCode, args ...string) { case rplKill: c.write(fmt.Sprintf(":%s KILL %s A %s", args[0], c.nick, args[1])) case rplMsg: - // FIXME escape newlines in message!! - c.write(fmt.Sprintf(":%s PRIVMSG %s %s", args[0], args[1], args[2])) + for _, itm := range strings.Split(args[2], "\n") { + c.write(fmt.Sprintf(":%s PRIVMSG %s %s", args[0], args[1], itm)) + } case rplList: c.write(fmt.Sprintf(":%s 322 %s %s", c.server.name, c.nick, args[0])) case rplListEnd: