diff options
Diffstat (limited to 'user_command.h')
| -rw-r--r-- | user_command.h | 20 | 
1 files changed, 17 insertions, 3 deletions
diff --git a/user_command.h b/user_command.h index 24c2f3e..2e73c90 100644 --- a/user_command.h +++ b/user_command.h @@ -14,10 +14,24 @@ void process_user_command() {  		// reset the global variable  		respond_to_chat_request = 0; -		if (strcmp(command, "y\n") == 0) { -			accept_callback_accept(); +		// first check that we haven't expired +		time_t now; +		time(&now); + +		double diff = difftime(now, chat_requested_time); + +		if (diff > REQUEST_TIMEOUT) { + +			printf("The request has timed out. \n"); +  		} else { -			accept_callback_decline(); + +			if (strcmp(command, "y\n") == 0) { +				accept_callback_accept(); +			} else { +				accept_callback_decline(); +			} +  		}  		return;  | 
