summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authorAstonex <softukitu@gmail.com>2013-08-03 15:12:22 +0100
committerAstonex <softukitu@gmail.com>2013-08-03 15:12:22 +0100
commit8fac63f6df7e9231bf0642b50881f52162803914 (patch)
treea34bc0a0df8c534dbc63229a8970959174a1c0d7 /testing
parentda8996dbdd1fd8aef24d10bdf80894260a4560a3 (diff)
Changing status to offline when quitting wont overwrite last saved status
Diffstat (limited to 'testing')
-rw-r--r--testing/nTox_win32.c28
-rw-r--r--testing/nTox_win32.h2
2 files changed, 16 insertions, 14 deletions
diff --git a/testing/nTox_win32.c b/testing/nTox_win32.c
index 55440828..5501ecf5 100644
--- a/testing/nTox_win32.c
+++ b/testing/nTox_win32.c
@@ -255,7 +255,7 @@ void change_nickname()
255 fclose(name_file); 255 fclose(name_file);
256} 256}
257 257
258void change_status() 258void change_status(int savetofile)
259{ 259{
260 uint8_t status[MAX_USERSTATUS_LENGTH]; 260 uint8_t status[MAX_USERSTATUS_LENGTH];
261 int i = 0; 261 int i = 0;
@@ -274,10 +274,12 @@ void change_status()
274 sprintf(numstring, "\n[i] changed status to %s\n\n", (char*)status); 274 sprintf(numstring, "\n[i] changed status to %s\n\n", (char*)status);
275 printf(numstring); 275 printf(numstring);
276 276
277 FILE* status_file = NULL; 277 if (savetofile == 1) {
278 status_file = fopen("statusfile.txt", "w"); 278 FILE* status_file = NULL;
279 fprintf(status_file, "%s", (char*)status); 279 status_file = fopen("statusfile.txt", "w");
280 fclose(status_file); 280 fprintf(status_file, "%s", (char*)status);
281 fclose(status_file);
282 }
281} 283}
282 284
283void accept_friend_request() 285void accept_friend_request()
@@ -298,7 +300,7 @@ void line_eval(char* line)
298 char inpt_command = line[1]; 300 char inpt_command = line[1];
299 301
300 if(inpt_command == 'f') { 302 if(inpt_command == 'f') {
301 add_friend(line); 303 add_friend();
302 } 304 }
303 305
304 else if (inpt_command == 'r') { 306 else if (inpt_command == 'r') {
@@ -307,23 +309,23 @@ void line_eval(char* line)
307 } 309 }
308 310
309 else if (inpt_command == 'l') { 311 else if (inpt_command == 'l') {
310 list_friends(line); 312 list_friends();
311 } 313 }
312 314
313 else if (inpt_command == 'd') { 315 else if (inpt_command == 'd') {
314 delete_friend(line); 316 delete_friend();
315 } 317 }
316 /* Send message to friend */ 318 /* Send message to friend */
317 else if (inpt_command == 'm') { 319 else if (inpt_command == 'm') {
318 message_friend(line); 320 message_friend();
319 } 321 }
320 322
321 else if (inpt_command == 'n') { 323 else if (inpt_command == 'n') {
322 change_nickname(line); 324 change_nickname();
323 } 325 }
324 326
325 else if (inpt_command == 's') { 327 else if (inpt_command == 's') {
326 change_status(line); 328 change_status(1);
327 } 329 }
328 330
329 else if (inpt_command == 'a') { 331 else if (inpt_command == 'a') {
@@ -332,8 +334,8 @@ void line_eval(char* line)
332 } 334 }
333 /* EXIT */ 335 /* EXIT */
334 else if (inpt_command == 'q') { 336 else if (inpt_command == 'q') {
335 strcpy(line, "Offline"); 337 strcpy(line, "---Offline");
336 change_status(line); 338 change_status(0);
337 exit(EXIT_SUCCESS); 339 exit(EXIT_SUCCESS);
338 } 340 }
339 } 341 }
diff --git a/testing/nTox_win32.h b/testing/nTox_win32.h
index 211ac95f..271403b8 100644
--- a/testing/nTox_win32.h
+++ b/testing/nTox_win32.h
@@ -39,7 +39,7 @@ void list_friends();
39void delete_friend(); 39void delete_friend();
40void message_friend(); 40void message_friend();
41void change_nickname(); 41void change_nickname();
42void change_status(); 42void change_status(int savetofile);
43void accept_friend_request(); 43void accept_friend_request();
44void line_eval(char* line); 44void line_eval(char* line);
45void get_input(); 45void get_input();