def lineReceived(self, line):
     print("Line Recieved: " + line)
     information_sent = pickle.loads(line)
     print information_sent
     task = information_sent['task']
     if task == 'LOGIN_SUCCESS':
         self.state = 'AUTH'
         exists, self.one_dir_path = retrieve_local_onedir(self.username)
         self.options()
     elif task == 'GET_DIFFERENT_USERNAME':
         print("That username has already been taken")
         self.create_username()
     elif task == 'GET_NEW_USER_PASSWORD':
         self.create_new_user_password()
     elif task == 'LOGIN_SUCCESS':
         self.state = 'AUTH'
         self.determine_if_auto_sync_on_or_off()
         self.options()
     elif task == 'LOGIN_FAIL':
         self.handle_login_fail()
     elif task == 'CREATE_ONEDIR':
         self.create_onedir(information_sent)
         self.state = 'AUTH'
         self.determine_if_auto_sync_on_or_off()
         self.options()
     elif task == 'RUN_FILE_DETECTION':
         self.tell_server_to_update_onedir()
     elif task == 'LOGOUT_SUCCESS':
         print 'Successfully Logged out!'
         self.logout()
     elif task == 'LOGOUT_FAIL':
         print 'Logout failed!'
         self.options()
     elif task == 'CHANGE_PASWD_SUCCESS':
         print 'Password Changed'
         self.options()
     elif task == 'CHANGE_PASWD_FAIL':
         print 'Password not successfully changed'
         self.options()
     elif task == 'OPTIONS':
         self.options()
     #elif task == 'RUN_FILE_DETECTION':
         #self.determine_if_auto_sync_on_or_off()
         #self.tell_server_to_update_onedir()
         #self.run_watchdog(self.process)
     elif task == 'RUN_FILE_DETECTION':
         self.tell_server_to_update_onedir()
     elif task == 'ADMIN_LOGGED_IN':
         ad = admin()
         result = ad.main()
         if result:
             self.connectionMade()
     else:
         print self.one_dir_path
         print information_sent
         _, self.one_dir_path = retrieve_local_onedir(self.username)
         update_directory(self.one_dir_path, information_sent)
 def handle_dir_change_from_client(self, information_sent):
     update_directory(self.one_dir_path, pickle.loads(information_sent["event"]))
     print self.logfile_path
     with open(self.logfile_path, "a") as logfile:
         logfile.write(self.ip_address + "*" + str(information_sent) + "\n")
     self.sendLine(pickle.dumps({"task": "OPTIONS"}))