mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-30 02:38:11 -07:00
Fix wordWrap function so it doesn't drop chars, and fix client.Notice() to automagically split very long lines.
This commit is contained in:
+9
-2
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user