summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTingPing <tingping@tingping.se>2014-02-16 19:47:22 -0500
committerTingPing <tingping@tingping.se>2014-02-16 19:47:22 -0500
commitdd128ce534a2c4922c68bb91b78c883a17b1698d (patch)
tree1a25874602441676e4d44108bd0df2338196610b
parent8f6a5960576a20bd6f6be731ad8d3dba6348927a (diff)
Remove migration code for xchat 1 colors
-rw-r--r--src/fe-gtk/palette.c89
1 files changed, 17 insertions, 72 deletions
diff --git a/src/fe-gtk/palette.c b/src/fe-gtk/palette.c
index 3aa15ba7..435ba84b 100644
--- a/src/fe-gtk/palette.c
+++ b/src/fe-gtk/palette.c
@@ -87,7 +87,6 @@ GdkColor colors[] = {
 	{0, 0xa4a4, 0x0000, 0x0000}, /* 41 spell checker color (red) */
 };
 
-
 void
 palette_alloc (GtkWidget * widget)
 {
@@ -104,37 +103,16 @@ palette_alloc (GtkWidget * widget)
 	}
 }
 
-/* maps HexChat 2.0.x colors to current */
-static const int remap[] =
-{
-	0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
-	33,	/* 16:marktextback */
-	32,	/* 17:marktextfore */
-	34,	/* 18: fg */
-	35,	/* 19: bg */
-	37,	/* 20: newdata */
-	38,	/* 21: blue */
-	39,	/* 22: newmsg */
-	40		/* 23: away */
-};
-
 void
 palette_load (void)
 {
-	int i, j, l, fh, res;
+	int i, j, l, fh;
 	char prefname[256];
 	struct stat st;
 	char *cfg;
 	int red, green, blue;
-	int upgrade = FALSE;
 
 	fh = hexchat_open_file ("colors.conf", O_RDONLY, 0, 0);
-	if (fh == -1)
-	{
-		fh = hexchat_open_file ("palette.conf", O_RDONLY, 0, 0);
-		upgrade = TRUE;
-	}
-
 	if (fh != -1)
 	{
 		fstat (fh, &st);
@@ -146,57 +124,24 @@ palette_load (void)
 			if (l >= 0)
 				cfg[l] = '\0';
 
-			if (!upgrade)
+			/* mIRC colors 0-31 are here */
+			for (i = 0; i < 32; i++)
 			{
-				/* mIRC colors 0-31 are here */
-				for (i = 0; i < 32; i++)
-				{
-					snprintf (prefname, sizeof prefname, "color_%d", i);
-					cfg_get_color (cfg, prefname, &red, &green, &blue);
-					colors[i].red = red;
-					colors[i].green = green;
-					colors[i].blue = blue;
-				}
-
-				/* our special colors are mapped at 256+ */
-				for (i = 256, j = 32; j < MAX_COL+1; i++, j++)
-				{
-					snprintf (prefname, sizeof prefname, "color_%d", i);
-					cfg_get_color (cfg, prefname, &red, &green, &blue);
-					colors[j].red = red;
-					colors[j].green = green;
-					colors[j].blue = blue;
-				}
-
-			} else
+				snprintf (prefname, sizeof prefname, "color_%d", i);
+				cfg_get_color (cfg, prefname, &red, &green, &blue);
+				colors[i].red = red;
+				colors[i].green = green;
+				colors[i].blue = blue;
+			}
+
+			/* our special colors are mapped at 256+ */
+			for (i = 256, j = 32; j < MAX_COL+1; i++, j++)
 			{
-				/* loading 2.0.x palette.conf */
-				for (i = 0; i < MAX_COL+1; i++)
-				{
-					snprintf (prefname, sizeof prefname, "color_%d_red", i);
-					red = cfg_get_int (cfg, prefname);
-
-					snprintf (prefname, sizeof prefname, "color_%d_grn", i);
-					green = cfg_get_int (cfg, prefname);
-
-					snprintf (prefname, sizeof prefname, "color_%d_blu", i);
-					blue = cfg_get_int_with_result (cfg, prefname, &res);
-
-					if (res)
-					{
-						colors[remap[i]].red = red;
-						colors[remap[i]].green = green;
-						colors[remap[i]].blue = blue;
-					}
-				}
-
-				/* copy 0-15 to 16-31 */
-				for (i = 0; i < 16; i++)
-				{
-					colors[i+16].red = colors[i].red;
-					colors[i+16].green = colors[i].green;
-					colors[i+16].blue = colors[i].blue;
-				}
+				snprintf (prefname, sizeof prefname, "color_%d", i);
+				cfg_get_color (cfg, prefname, &red, &green, &blue);
+				colors[j].red = red;
+				colors[j].green = green;
+				colors[j].blue = blue;
 			}
 			free (cfg);
 		}