diff mcabber/src/screen.c @ 267:8d3d5bd52da3

Improve color configuration * Rename color options (it made no sense!!) * Use default values * Do not crash anymore when the colors options are buggy in the mcabberrc
author mikael@frmp8452
date Sun, 03 Jul 2005 00:21:59 +0100
parents 49e9e02dd6d0
children 3c07026f1b47
line wrap: on
line diff
--- a/mcabber/src/screen.c	Sat Jul 02 19:27:15 2005 +0100
+++ b/mcabber/src/screen.c	Sun Jul 03 00:21:59 2005 +0100
@@ -134,26 +134,28 @@
 
 void ParseColors(void)
 {
-  char *colors[11] = {
+  char *colors[8] = {
     "", "",
-    "borderlines",
-    "jidonline",
+    "general",
     "newmsg",
-    "jidofflineselected",
-    "jidoffline",
-    "text",
+    "rosterselect",
+    "rosternormal",
     NULL
   };
 
   char *tmp = malloc(1024);
-  char *color1;
+  char *color;
   char *background = cfg_read("color_background");
   char *backselected = cfg_read("color_backselected");
   int i = 0;
 
+  // Default values
+  if (!background)   background   = "blue";
+  if (!backselected) backselected = "cyan";
+
   while (colors[i]) {
     sprintf(tmp, "color_%s", colors[i]);
-    color1 = cfg_read(tmp);
+    color = cfg_read(tmp);
 
     switch (i + 1) {
     case 1:
@@ -163,22 +165,20 @@
       init_pair(2, COLOR_WHITE, COLOR_BLACK);
       break;
     case 3:
-      init_pair(3, FindColor(color1), FindColor(background));
+      init_pair(3, ((color) ? FindColor(color) : COLOR_WHITE),
+                FindColor(background));
       break;
     case 4:
-      init_pair(4, FindColor(color1), FindColor(backselected));
+      init_pair(4, ((color) ? FindColor(color) : COLOR_RED),
+                FindColor(background));
       break;
     case 5:
-      init_pair(5, FindColor(color1), FindColor(background));
+      init_pair(5, ((color) ? FindColor(color) : COLOR_BLACK),
+                FindColor(backselected));
       break;
     case 6:
-      init_pair(6, FindColor(color1), FindColor(backselected));
-      break;
-    case 7:
-      init_pair(7, FindColor(color1), FindColor(background));
-      break;
-    case 8:
-      init_pair(8, FindColor(color1), FindColor(background));
+      init_pair(6, ((color) ? FindColor(color) : COLOR_MAGENTA),
+                FindColor(background));
       break;
     }
     i++;