relay: fix parsing of commands in server window

* also replace if statements with switch