mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-16 09:00:38 +03:00
Block the broadcast of an empty message
This commit is contained in:
parent
857dcd0a14
commit
25dc161348
@ -56,7 +56,7 @@ func NewClient(server *Server, conn *ssh.ServerConn) *Client {
|
||||
}
|
||||
|
||||
func (c *Client) ColoredName() string {
|
||||
return ColorString(c.Color, c.Name)
|
||||
return ColorString(c.Color, c.Name)
|
||||
}
|
||||
|
||||
func (c *Client) Write(msg string) {
|
||||
@ -229,7 +229,7 @@ func (c *Client) handleShell(channel ssh.Channel) {
|
||||
}
|
||||
|
||||
msg := fmt.Sprintf("%s: %s", c.ColoredName(), line)
|
||||
if c.IsSilenced() || len(msg) > 1000 {
|
||||
if c.IsSilenced() || len(msg) > 1000 || len(line) < 1 {
|
||||
c.Msg <- fmt.Sprintf("-> Message rejected.")
|
||||
continue
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user