Add stdout and systemd service file, change drone ci file
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@@ -54,7 +54,7 @@ int char_find(int idx, const char *s, char ch)
 | 
			
		||||
void log_msg(Tox *tox, const uint8_t *inmsg, uint32_t friend_number, bool user)
 | 
			
		||||
{
 | 
			
		||||
    char name[TOX_MAX_NAME_LENGTH];
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
    if (user == true) {
 | 
			
		||||
        tox_friend_get_name(tox, friend_number, (uint8_t *) name, NULL);
 | 
			
		||||
        size_t len = tox_friend_get_name_size(tox, friend_number, NULL);
 | 
			
		||||
@@ -74,7 +74,7 @@ void log_msg(Tox *tox, const uint8_t *inmsg, uint32_t friend_number, bool user)
 | 
			
		||||
 | 
			
		||||
    strftime(cur_time, 128, "%d-%b-%Y %H:%M:%S", ptm);
 | 
			
		||||
 | 
			
		||||
    printf("%s (%s): %s\n", cur_time, name, inmsg);
 | 
			
		||||
    fprintf(stdout, "%s (%s): %s\n", cur_time, name, inmsg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int file_contains_key(const char *public_key, const char *path)
 | 
			
		||||
 
 | 
			
		||||
@@ -79,25 +79,25 @@ int config_tox(Tox *tox)
 | 
			
		||||
    const char *name;
 | 
			
		||||
 | 
			
		||||
    if (config_lookup_string(&cfg, "Tox_Bot_Name", &str)) {
 | 
			
		||||
      printf("Tox bot name: %s\n", str);
 | 
			
		||||
      fprintf(stdout, "Tox bot name: %s\n", str);
 | 
			
		||||
      name = str;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      name = "Tox Bot test";
 | 
			
		||||
      fprintf(stderr, "No 'Tox_Bot_Name' setting in configuration file. ");
 | 
			
		||||
      printf("The default name is used\n");
 | 
			
		||||
      fprintf(stdout, "The default name is used\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    const char *status_message;
 | 
			
		||||
 | 
			
		||||
    if (config_lookup_string(&cfg, "Tox_Bot_Status", &str)) {
 | 
			
		||||
      printf("Tox bot status: %s\n", str);
 | 
			
		||||
      fprintf(stdout, "Tox bot status: %s\n", str);
 | 
			
		||||
      status_message = str;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      status_message = "Hello, World!";
 | 
			
		||||
      fprintf(stderr, "No 'Tox_Bot_Status' setting in configuration file. ");
 | 
			
		||||
      printf("The default status is used\n");
 | 
			
		||||
      fprintf(stdout, "The default status is used\n");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    tox_self_set_name(tox, name, strlen(name), NULL);
 | 
			
		||||
@@ -199,7 +199,7 @@ void print_tox_id(Tox *tox)
 | 
			
		||||
        tox_id_hex[i] = toupper(tox_id_hex[i]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    printf("Tox ID: %s\n", tox_id_hex);
 | 
			
		||||
    fprintf(stdout, "Tox ID: %s\n", tox_id_hex);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -219,12 +219,12 @@ static void friend_request_cb(Tox *tox, const uint8_t *public_key, const uint8_t
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (file_contains_key(public_key, MASTERLIST_FILE) == 1) {
 | 
			
		||||
      printf("New friend is Master: %s\n", tox_id_hex);
 | 
			
		||||
      fprintf(stdout, "New friend is Master: %s\n", tox_id_hex);
 | 
			
		||||
      tox_friend_add_norequest(tox, public_key, NULL);
 | 
			
		||||
      update_savedata_file(tox);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
      printf("New friend not on the list: %s\n", tox_id_hex);
 | 
			
		||||
      fprintf(stdout, "New friend not on the list: %s\n", tox_id_hex);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -256,13 +256,13 @@ void self_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status, void
 | 
			
		||||
{
 | 
			
		||||
    switch (connection_status) {
 | 
			
		||||
        case TOX_CONNECTION_NONE:
 | 
			
		||||
            printf("Offline\n");
 | 
			
		||||
            fprintf(stdout, "Offline\n");
 | 
			
		||||
            break;
 | 
			
		||||
        case TOX_CONNECTION_TCP:
 | 
			
		||||
            printf("Online, using TCP\n");
 | 
			
		||||
            fprintf(stdout, "Online, using TCP\n");
 | 
			
		||||
            break;
 | 
			
		||||
        case TOX_CONNECTION_UDP:
 | 
			
		||||
            printf("Online, using UDP\n");
 | 
			
		||||
            fprintf(stdout, "Online, using UDP\n");
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -285,7 +285,7 @@ int main()
 | 
			
		||||
 | 
			
		||||
    update_savedata_file(tox);
 | 
			
		||||
 | 
			
		||||
    printf("Connecting...\n");
 | 
			
		||||
    fprintf(stdout, "Connecting...\n");
 | 
			
		||||
 | 
			
		||||
    while (1) {
 | 
			
		||||
        tox_iterate(tox, NULL);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user