mirror of
https://github.com/shazow/ssh-chat.git
synced 2026-11-24 03:17:00 +03:00
Block the broadcast of an empty message
This commit is contained in:
1 parent
857dcd0a14
commit
25dc161348
1 file changed
+2
-2
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user