Index: client/Client/main.cpp
===================================================================
--- client/Client/main.cpp	(revision 171c4fe27d3dc99de40df4f9db5468be6790acc3)
+++ client/Client/main.cpp	(revision 633f42acbded795ad1b07dc68558434aabe5690b)
@@ -51,5 +51,6 @@
 enum STATE {
    STATE_START,
-   STATE_LOGIN
+   STATE_LOGIN,
+   STATE_LOGOUT
 };
  
@@ -202,22 +203,35 @@
                switch(state)
                {
-               case STATE_START:
-                  msgTo.type = MSG_TYPE_LOGIN;
-                  username = input;
-                  break;
-               case STATE_LOGIN:
-                  if (input.compare("quit") == 0 ||
-                      input.compare("exit") == 0 ||
-                      input.compare("logout") == 0)
-                  {
-                     strcpy(msgTo.buffer, username.c_str());
-                     msgTo.type = MSG_TYPE_LOGOUT;
-                  }
-                  else
-                     msgTo.type = MSG_TYPE_CHAT;
-                  break;
-               default:
-                  cout << "The state has an invalid value: " << state << endl;
-                  break;
+                  case STATE_START:
+                  {
+                     msgTo.type = MSG_TYPE_LOGIN;
+                     username = input;
+                     break;
+                  }
+                  case STATE_LOGIN:
+                  {
+                     if (input.compare("quit") == 0 ||
+                         input.compare("exit") == 0 ||
+                         input.compare("logout") == 0)
+                     {
+                        strcpy(msgTo.buffer, username.c_str());
+                        msgTo.type = MSG_TYPE_LOGOUT;
+                     }
+                     else
+                        msgTo.type = MSG_TYPE_CHAT;
+                     break;
+                  }
+                  case STATE_LOGOUT:
+                  {
+                     cout << "Bug: You're logged out, so you shouldn't be receiving any messages." << endl;
+                  
+                     break;
+                  }
+                  default:
+                  {
+                     cout << "The state has an invalid value: " << state << endl;
+                  
+                     break;
+                  }
                }
 
@@ -230,12 +244,13 @@
                   error("receiveMessage");
 
+               string response = string(msgFrom.buffer);
+
                switch(state)
                {
                   case STATE_START:
                   {
-                     string loginResponse = string(msgFrom.buffer);
                      chatConsole.addLine(string(msgFrom.buffer));
 
-                     if (loginResponse.compare("Player has already logged in.") == 0)
+                     if (response.compare("Player has already logged in.") == 0)
                      {
                         cout << "User login failed" << endl;
@@ -252,5 +267,20 @@
                   {
                      chatConsole.addLine(string(msgFrom.buffer));
-                     cout << "Added new line" << endl;
+
+                     if (response.compare("You have been successfully logged out. You may quit the game.") == 0)
+                     {
+                        state = STATE_LOGOUT;
+                     }
+                     else
+                     {
+                        cout << "Added new line" << endl;
+                     }
+                     
+                     break;
+                  }
+                  case STATE_LOGOUT:
+                  {
+                     cout << "Bug: You're logged out, so you shouldn't be receiving any messages." << endl;
+                  
                      break;
                   }
@@ -258,4 +288,5 @@
                   {
                      cout << "The state has an invalid value: " << state << endl;
+
                      break;
                   }
