Allow colors by dft and config file
Allow colors by dft and config file

--- a/src/config.c
+++ b/src/config.c
@@ -42,6 +42,7 @@
 
 	/* now client configuration */
 	srv->num_clients = 0;
+	srv->allow_colors_dft = ALLOW_COLORS_DFT_CLIENTS;
 }
 
 void
@@ -105,7 +106,6 @@
 int
 read_config_file(struct srv_conf *srv, char *config_file)
 { /* {{{ */
-	struct srv_conf a = *srv;
 #define TNC_LINE_BUFFER_SIZE 200
 	char line_buffer[TNC_LINE_BUFFER_SIZE];
 	char *opt, *arg;
@@ -158,8 +158,10 @@
 		srv->port = strtoul(arg, NULL, 10);
 	}
 	else if(!strcmp(opt, "default-color")) {
-
-
+		if(*arg == 'Y' || *arg == 'y' || *arg == '1' || *arg == 't')
+			srv->allow_colors_dft = 1;
+		else
+			srv->allow_colors_dft = 0;
 	}
 	else {
 		fprintf(stderr, "Unknown option: %s (arg: %s, line: %d)\n",

--- a/src/connections.c
+++ b/src/connections.c
@@ -51,7 +51,7 @@
 
 	for (i = 0; i <= MAX_CLIENTS; i++) {
 		srv->client_list[i].fd = -1;
-		srv->client_list[i].allow_colors = ALLOW_COLORS_DFT_CLIENTS;
+		srv->client_list[i].allow_colors = srv->allow_colors_dft;
 	}
 
 } /* }}} */
@@ -69,7 +69,7 @@
 
 	srv->client_list[new_client].fd = new_client_fd;
 
-	srv->client_list[new_client].allow_colors = ALLOW_COLORS_DFT_CLIENTS;
+	srv->client_list[new_client].allow_colors = srv->allow_colors_dft;
 
 	srv->client_list[new_client].id = (time(NULL) % MAX_CLIENTS);
 

--- a/src/server.h
+++ b/src/server.h
@@ -75,6 +75,7 @@
 	int num_clients;
 	struct s_client client_list[MAX_CLIENTS + 1];
 	struct pollfd fds[MAX_CLIENTS + 1];
+	int allow_colors_dft;
 
 	/* serv. general config */
 	char *config_file;