Mercurial > pidgin
comparison 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 |
comparison
equal
deleted
inserted
replaced
6092:35560e017fa1 | 6093:13a37cacd10b |
---|---|
83 char * | 83 char * |
84 msn_parse_format(const char *mime) | 84 msn_parse_format(const char *mime) |
85 { | 85 { |
86 char *cur; | 86 char *cur; |
87 GString *ret = g_string_new(NULL); | 87 GString *ret = g_string_new(NULL); |
88 guint colorbuf; | 88 unsigned int colors[3]; |
89 unsigned char *colors = (unsigned char *)(&colorbuf); | |
90 | 89 |
91 cur = strstr(mime, "FN="); | 90 cur = strstr(mime, "FN="); |
92 | 91 |
93 if (cur && (*(cur = cur + 3) != ';')) { | 92 if (cur && (*(cur = cur + 3) != ';')) { |
94 ret = g_string_append(ret, "<FONT FACE=\""); | 93 ret = g_string_append(ret, "<FONT FACE=\""); |
113 } | 112 } |
114 | 113 |
115 cur = strstr(mime, "CO="); | 114 cur = strstr(mime, "CO="); |
116 | 115 |
117 if (cur && (*(cur = cur + 3) != ';')) { | 116 if (cur && (*(cur = cur + 3) != ';')) { |
118 if (sscanf (cur, "%x;", &colorbuf) == 1) { | 117 int i; |
118 | |
119 i = sscanf(cur, "%02x%02x%02x;", &colors[0], &colors[1], &colors[2]); | |
120 | |
121 if (i > 0) { | |
119 char tag[64]; | 122 char tag[64]; |
123 | |
124 if (i == 1) { | |
125 colors[2] = colors[0]; | |
126 colors[1] = 0; | |
127 colors[0] = 0; | |
128 } | |
129 else if (i == 2) { | |
130 colors[2] = colors[1]; | |
131 colors[1] = colors[0]; | |
132 colors[0] = 0; | |
133 } | |
134 | |
120 g_snprintf(tag, sizeof(tag), | 135 g_snprintf(tag, sizeof(tag), |
121 "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">", | 136 "<FONT COLOR=\"#%02hhx%02hhx%02hhx\">", |
122 colors[0], colors[1], colors[2]); | 137 colors[2], colors[1], colors[0]); |
123 | 138 |
124 ret = g_string_append(ret, tag); | 139 ret = g_string_append(ret, tag); |
125 } | 140 } |
126 } | 141 } |
127 | 142 |