Fixing len check.

This commit is contained in:
Andrey Petrov 2014-12-12 19:46:30 -08:00
parent cecf00874f
commit 705cc9e1be

View File

@ -131,10 +131,10 @@ func (c *Client) handleShell(channel ssh.Channel) {
me = " is at a loss for words." me = " is at a loss for words."
} }
msg := fmt.Sprintf("** %s%s", c.Name, me) msg := fmt.Sprintf("** %s%s", c.Name, me)
if c.IsSilenced() { if c.IsSilenced() || len(msg) > 1000 {
c.Msg <- fmt.Sprintf("-> Message rejected, silenced.") c.Msg <- fmt.Sprintf("-> Message rejected.")
} else { } else {
c.Server.Broadcast(msg[:200], nil) c.Server.Broadcast(msg, nil)
} }
case "/nick": case "/nick":
if len(parts) == 2 { if len(parts) == 2 {