Prevent some zero length stuff

Don't send zero length messages to the server, and ignore the /me
command without any arguments.
This commit is contained in:
Zorchenhimer 2019-03-23 15:16:02 -04:00
parent c0d3731b84
commit 8e39585968
2 changed files with 7 additions and 1 deletions

View File

@ -26,7 +26,9 @@ var commands = &CommandControl{
common.CNMe.String(): Command{
HelpText: "Display an action message.",
Function: func(client *Client, args []string) string {
client.Me(strings.Join(args, " "))
if len(args) != 0 {
client.Me(strings.Join(args, " "))
}
return ""
},
},

View File

@ -224,6 +224,10 @@ func recieve(v []js.Value) {
}
func websocketSend(msg string, dataType common.ClientDataType) error {
if strings.TrimSpace(msg) == "" {
return nil
}
data, err := json.Marshal(common.ClientData{
Type: dataType,
Message: msg,