diff src/protocols/msn/utils.c @ 6093:13a37cacd10b

[gaim-migrate @ 6552] This should fix incoming colors on MSN. That or break it horribly. I'll find out when I test it. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 11 Jul 2003 22:00:24 +0000
parents b583de5880bc
children 8ba58b296cc1
line wrap: on
line diff
--- a/src/protocols/msn/utils.c	Fri Jul 11 22:00:01 2003 +0000
+++ b/src/protocols/msn/utils.c	Fri Jul 11 22:00:24 2003 +0000
@@ -85,8 +85,7 @@
 {
 	char *cur;
 	GString *ret = g_string_new(NULL);
-	guint colorbuf;
-	unsigned char *colors = (unsigned char *)(&colorbuf);
+	unsigned int colors[3];
 
 	cur = strstr(mime, "FN=");
 
@@ -115,11 +114,27 @@
 	cur = strstr(mime, "CO=");
 
 	if (cur && (*(cur = cur + 3) != ';')) {
-		if (sscanf (cur, "%x;", &colorbuf) == 1) {
+		int i;
+
+		i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]);
+
+		if (i > 0) {
 			char tag[64];
+
+			if (i == 1) {
+				colors[2] = colors[0];
+				colors[1] = 0;
+				colors[0] = 0;
+			}
+			else if (i == 2) {
+				colors[2] = colors[1];
+				colors[1] = colors[0];
+				colors[0] = 0;
+			}
+
 			g_snprintf(tag, sizeof(tag),
 					   "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">",
-					   colors[0], colors[1], colors[2]);
+					   colors[2], colors[1], colors[0]);
 
 			ret = g_string_append(ret, tag);
 		}