summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testing/toxic/chat.c4
-rw-r--r--testing/toxic/main.c39
2 files changed, 27 insertions, 16 deletions
diff --git a/testing/toxic/chat.c b/testing/toxic/chat.c
index c11a7f12..eb297f7c 100644
--- a/testing/toxic/chat.c
+++ b/testing/toxic/chat.c
@@ -236,6 +236,7 @@ void print_help(ChatContext* self) {
236 wprintw(self->history, " /nick <nickname> : Set your nickname\n"); 236 wprintw(self->history, " /nick <nickname> : Set your nickname\n");
237 wprintw(self->history, " /myid : Print your ID\n"); 237 wprintw(self->history, " /myid : Print your ID\n");
238 wprintw(self->history, " /clear : Clear the screen\n"); 238 wprintw(self->history, " /clear : Clear the screen\n");
239 wprintw(self->history, " /close : Closes the current chat window\n");
239 wprintw(self->history, " /quit or /exit : Exit program\n"); 240 wprintw(self->history, " /quit or /exit : Exit program\n");
240 wprintw(self->history, " /help : Print this message again\n\n"); 241 wprintw(self->history, " /help : Print this message again\n\n");
241 242
@@ -264,5 +265,6 @@ ToxWindow new_chat(int friendnum) {
264 x->friendnum = friendnum; 265 x->friendnum = friendnum;
265 266
266 ret.x = (void*) x; 267 ret.x = (void*) x;
268 free(x);
267 return ret; 269 return ret;
268} \ No newline at end of file 270}
diff --git a/testing/toxic/main.c b/testing/toxic/main.c
index e55cb85d..42657e88 100644
--- a/testing/toxic/main.c
+++ b/testing/toxic/main.c
@@ -337,28 +337,37 @@ void set_active_window(int ch) {
337 337
338int main(int argc, char* argv[]) { 338int main(int argc, char* argv[]) {
339 int ch; 339 int ch;
340 int i = 0;
341 int f_flag = 0;
342 char *filename = "data";
340 ToxWindow* a; 343 ToxWindow* a;
341 344
345 for(i = 0; i < argc; i++) {
346 if (argv[i] == NULL){
347 break;
348 } else if(argv[i][0] == '-') {
349 if(argv[i][1] == 'f') {
350 if(argv[i + 1] != NULL)
351 filename = argv[i + 1];
352 else {
353 f_flag = -1;
354 }
355 }
356 }
357 }
358
342 init_term(); 359 init_term();
343 init_tox(); 360 init_tox();
344 init_window_status();
345 init_windows();
346 char *filename = "data";
347 load_data(filename); 361 load_data(filename);
362 init_windows();
348 363
349 int i; 364 if(f_flag == -1) {
350 for(i = 0; i < argc; i++) { 365 attron(COLOR_PAIR(3) | A_BOLD);
351 if(argv[i][0] == '-' && argv[i][1] == 'f') { 366 wprintw(prompt->window, "You passed '-f' without giving an argument!\n"
352 if(argv[i + 1] != NULL)
353 filename = argv[i + 1];
354 else {
355 attron(COLOR_PAIR(3) | A_BOLD);
356 wprintw(prompt->window, "You passed '-f' without giving an argument!\n"
357 "defaulting to 'data' for a keyfile...\n"); 367 "defaulting to 'data' for a keyfile...\n");
358 attroff(COLOR_PAIR(3) | A_BOLD); 368 attroff(COLOR_PAIR(3) | A_BOLD);
359 }
360 }
361 } 369 }
370
362 while(true) { 371 while(true) {
363 // Update tox. 372 // Update tox.
364 do_tox(); 373 do_tox();
@@ -382,4 +391,4 @@ int main(int argc, char* argv[]) {
382 } 391 }
383 } 392 }
384 return 0; 393 return 0;
385} \ No newline at end of file 394}