Rewrote the big switch case in both server and client.

The switch became unmanageble when trying to add new messages. Now
compilation errors or readable error messages should be given instead
of quiessence.