From: Bernhard Tittelbach Date: Mon, 19 Jan 2015 18:52:53 +0000 (+0000) Subject: button does not need user X-Git-Url: https://git.realraum.at/?p=svn42.git;a=commitdiff_plain;h=d63674ad22a6c04a1eb0a17d766d189182a5dd70 button does not need user --- diff --git a/go/door_daemon_zmq/handle_commands.go b/go/door_daemon_zmq/handle_commands.go index 33db54e..e8c3334 100644 --- a/go/door_daemon_zmq/handle_commands.go +++ b/go/door_daemon_zmq/handle_commands.go @@ -22,7 +22,7 @@ var cmdToDoorCmdHandler = map[string]DoorCmdHandler { func checkCmdDoorControl(tokens [][]byte) (error) { doorctrl_usage := "syntax: " - if len(tokens) != 3 { + if len(tokens) < 2 || len(tokens) > 3 { return errors.New(doorctrl_usage) } cmd := string(tokens[0]) @@ -33,7 +33,7 @@ func checkCmdDoorControl(tokens [][]byte) (error) { if ! (method == "Button" || method == "ssh" || method == "SSH" || method == "Phone") { return errors.New("method must be one either Button, SSH or Phone") } - if len(tokens[2]) == 0 && method != "Button" { + if (len(tokens) == 2 || len(tokens[2]) == 0) && method != "Button" { return errors.New("Operator nickname must be given") } return nil