mirror of
				https://github.com/Tha14/toxic.git
				synced 2025-11-04 09:26:52 +01:00 
			
		
		
		
	test
This commit is contained in:
		
							
								
								
									
										2
									
								
								chat.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								chat.c
									
									
									
									
									
								
							@@ -236,6 +236,7 @@ void print_help(ChatContext* self) {
 | 
				
			|||||||
  wprintw(self->history, "      /nick <nickname>           : Set your nickname\n");
 | 
					  wprintw(self->history, "      /nick <nickname>           : Set your nickname\n");
 | 
				
			||||||
  wprintw(self->history, "      /myid                      : Print your ID\n");
 | 
					  wprintw(self->history, "      /myid                      : Print your ID\n");
 | 
				
			||||||
  wprintw(self->history, "      /clear                     : Clear the screen\n");
 | 
					  wprintw(self->history, "      /clear                     : Clear the screen\n");
 | 
				
			||||||
 | 
					  wprintw(self->history, "      /close                     : Closes the current chat window\n");
 | 
				
			||||||
  wprintw(self->history, "      /quit or /exit             : Exit program\n");
 | 
					  wprintw(self->history, "      /quit or /exit             : Exit program\n");
 | 
				
			||||||
  wprintw(self->history, "      /help                      : Print this message again\n\n");
 | 
					  wprintw(self->history, "      /help                      : Print this message again\n\n");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -264,5 +265,6 @@ ToxWindow new_chat(int friendnum) {
 | 
				
			|||||||
  x->friendnum = friendnum;
 | 
					  x->friendnum = friendnum;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  ret.x = (void*) x;
 | 
					  ret.x = (void*) x;
 | 
				
			||||||
 | 
					  free(x);
 | 
				
			||||||
  return ret;
 | 
					  return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
							
								
								
									
										37
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										37
									
								
								main.c
									
									
									
									
									
								
							@@ -337,28 +337,37 @@ void set_active_window(int ch) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int main(int argc, char* argv[]) {
 | 
					int main(int argc, char* argv[]) {
 | 
				
			||||||
  int ch;
 | 
					  int ch;
 | 
				
			||||||
 | 
					  int i = 0;
 | 
				
			||||||
 | 
					  int f_flag = 0;
 | 
				
			||||||
 | 
					  char *filename = "data";
 | 
				
			||||||
  ToxWindow* a;
 | 
					  ToxWindow* a;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    for(i = 0; i < argc; i++) {
 | 
				
			||||||
 | 
					      if (argv[i] == NULL){
 | 
				
			||||||
 | 
					        break; 
 | 
				
			||||||
 | 
					      } else if(argv[i][0] == '-') {
 | 
				
			||||||
 | 
					            if(argv[i][1] == 'f') {
 | 
				
			||||||
 | 
					                if(argv[i + 1] != NULL)
 | 
				
			||||||
 | 
					                    filename = argv[i + 1];
 | 
				
			||||||
 | 
					                else {
 | 
				
			||||||
 | 
					                    f_flag = -1;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  init_term();
 | 
					  init_term();
 | 
				
			||||||
  init_tox();
 | 
					  init_tox();
 | 
				
			||||||
  init_window_status();
 | 
					 | 
				
			||||||
  init_windows();
 | 
					 | 
				
			||||||
  char *filename = "data";
 | 
					 | 
				
			||||||
  load_data(filename);
 | 
					  load_data(filename);
 | 
				
			||||||
 | 
					  init_windows();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  int i;
 | 
					  if(f_flag == -1) {
 | 
				
			||||||
  for(i = 0; i < argc; i++) {
 | 
					    attron(COLOR_PAIR(3) | A_BOLD);
 | 
				
			||||||
    if(argv[i][0] == '-' && argv[i][1] == 'f') {
 | 
					    wprintw(prompt->window, "You passed '-f' without giving an argument!\n"
 | 
				
			||||||
      if(argv[i + 1] != NULL)
 | 
					 | 
				
			||||||
        filename = argv[i + 1];
 | 
					 | 
				
			||||||
      else {
 | 
					 | 
				
			||||||
        attron(COLOR_PAIR(3) | A_BOLD);
 | 
					 | 
				
			||||||
        wprintw(prompt->window, "You passed '-f' without giving an argument!\n"
 | 
					 | 
				
			||||||
                            "defaulting to 'data' for a keyfile...\n");
 | 
					                            "defaulting to 'data' for a keyfile...\n");
 | 
				
			||||||
        attroff(COLOR_PAIR(3) | A_BOLD);
 | 
					    attroff(COLOR_PAIR(3) | A_BOLD);
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  while(true) {
 | 
					  while(true) {
 | 
				
			||||||
    // Update tox.
 | 
					    // Update tox.
 | 
				
			||||||
    do_tox();
 | 
					    do_tox();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user