diff options
author | Ben Burwell <bburwell1@gmail.com> | 2013-04-30 10:52:41 -0400 |
---|---|---|
committer | Ben Burwell <bburwell1@gmail.com> | 2013-04-30 10:52:41 -0400 |
commit | 0322fefa7f5f465909ccd95c85a088d9cf83812e (patch) | |
tree | 862ac466912289d8adb4bcf58331ce7861848400 /user_command.h | |
parent | ca9e46c937e75df43d2f80f0d957fabb07892c29 (diff) |
Changes
Diffstat (limited to 'user_command.h')
-rw-r--r-- | user_command.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/user_command.h b/user_command.h index 1c554e6..1dac4a9 100644 --- a/user_command.h +++ b/user_command.h @@ -9,6 +9,51 @@ void process_user_command() { int i; + if (respond_to_chat_request) { + + // reset the global variable + respond_to_chat_request = 0; + + if (strcmp(command, "y\n") == 0) { + accept_callback_accept(); + } else { + accept_callback_decline(); + } + + return; + } + + if (strcmp(in_chat, "Y") == 0) { + + // in chat, send input to the peer + + if (strcmp(command, "/q\n") == 0) { + + // send the quit message + strcpy(out_buf, "SESQ"); + send(client_s, out_buf, strlen(out_buf)+1, 0); + + // close the socket + close(client_s); + + // set my flag + strcpy(in_chat, "N"); + + // reset prompt + strcpy(prompt, ">"); + + } else { + + strcpy(out_buf, "SESMSG:"); + strcat(out_buf, command); + send(client_s, out_buf, strlen(out_buf)+1, 0); + + } + + return; + + } + if (strcmp(command, "quit\n") == 0) { exit(0); } else if (strcmp(command, "who\n") == 0) { |