1
0
Fork 0
forked from External/ergo

Fix wordWrap function so it doesn't drop chars, and fix client.Notice() to automagically split very long lines.

This commit is contained in:
Daniel Oaks 2017-05-09 21:09:44 +10:00
parent 9fe7c143c8
commit d847d55c06
2 changed files with 27 additions and 7 deletions

View file

@ -623,7 +623,14 @@ func (client *Client) Send(tags *map[string]ircmsg.TagValue, prefix string, comm
}
// Notice sends the client a notice from the server.
//TODO(dan): Make this handle message splitting.
func (client *Client) Notice(text string) {
client.Send(nil, client.server.name, "NOTICE", client.nick, text)
limit := 400
if client.capabilities[MaxLine] {
limit = client.server.limits.LineLen.Rest - 110
}
lines := wordWrap(text, limit)
for _, line := range lines {
client.Send(nil, client.server.name, "NOTICE", client.nick, line)
}
}