diff options
author | Jeffrey Armstrong <jeff@approximatrix.com> | 2021-05-11 20:09:08 -0400 |
---|---|---|
committer | Jeffrey Armstrong <jeff@approximatrix.com> | 2021-05-11 20:09:08 -0400 |
commit | a25527272916f342875809d7c3606ba0ebd350b4 (patch) | |
tree | 4a4767bd07d181509535a2cc397a5a057b3503ef /captain/requtils.f90 | |
parent | 0f31824a5e4969d56d88678e05274163be3d8b77 (diff) | |
download | levitating-a25527272916f342875809d7c3606ba0ebd350b4.tar.gz levitating-a25527272916f342875809d7c3606ba0ebd350b4.zip |
Moved some command handling into requtils to share with web and gemini modes. Started work on handling post requests to add players.
Diffstat (limited to 'captain/requtils.f90')
-rw-r--r-- | captain/requtils.f90 | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/captain/requtils.f90 b/captain/requtils.f90 index 7010bcb..cb52113 100644 --- a/captain/requtils.f90 +++ b/captain/requtils.f90 @@ -319,4 +319,41 @@ contains end subroutine get_job_page_title + subroutine handle_instruction_command(req) + use captain_db + use server_response + use remote_launch + implicit none + + type(request), intent(in)::req + character(32)::command + character(PLAYER_NAME_LENGTH)::argument, instruction_name + + integer::i, j + + i = index(req%page, ".", back=.true.) + + instruction_name = req%page(1:i-1) + + i = index(req%query_string, "=") + command = req%query_string(1:i-1) + argument = req%query_string(i+1:len_trim(req%query_string)) + + if(trim(command) == "launch") then + call launch_instructions_on_player(instruction_name, argument) + + else if(trim(command) == "assign") then + i = get_instruction_id(trim(instruction_name)) + j = get_player_id(trim(argument)) + call add_player_for_instruction(i, j) + + else if(trim(command) == "remove") then + i = get_instruction_id(trim(instruction_name)) + j = get_player_id(trim(argument)) + call remove_player_for_instruction(i, j) + + end if + + end subroutine handle_instruction_command + end module request_utils
\ No newline at end of file |