From: Nathan W. <fac...@us...> - 2004-01-10 18:38:51
|
Update of /cvsroot/gaim/gaim/src In directory sc8-pr-cvs1:/tmp/cvs-serv4499/src Modified Files: util.c Log Message: this fixes some things gtkimhtml seems to have trouble with foreground colors, maybe, i think Index: util.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/util.c,v retrieving revision 1.261 retrieving revision 1.262 diff -u -d -p -r1.261 -r1.262 --- util.c 10 Jan 2004 18:13:52 -0000 1.261 +++ util.c 10 Jan 2004 18:38:47 -0000 1.262 @@ -652,6 +652,7 @@ gaim_markup_extract_info_field(const cha struct gaim_parse_tag { char *src_tag; char *dest_tag; + gboolean ignore; }; #define ALLOW_TAG_ALT(x, y) if(!g_ascii_strncasecmp(c, "<" x " ", strlen("<" x " "))) { \ @@ -843,7 +844,19 @@ gaim_markup_html_to_xhtml(const char *ht GString *style = g_string_new(""); struct gaim_parse_tag *pt; while(*p && *p != '>') { - if(!g_ascii_strncasecmp(p, "color=", strlen("color="))) { + if(!g_ascii_strncasecmp(p, "back=", strlen("back="))) { + const char *q = p + strlen("back="); + GString *color = g_string_new(""); + if(*q == '\'' || *q == '\"') + q++; + while(*q && *q != '\"' && *q != '\'' && *q != ' ') { + color = g_string_append_c(color, *q); + q++; + } + g_string_append_printf(style, "background: %s; ", color->str); + g_string_free(color, TRUE); + p = q; + } else if(!g_ascii_strncasecmp(p, "color=", strlen("color="))) { const char *q = p + strlen("color="); GString *color = g_string_new(""); if(*q == '\'' || *q == '\"') @@ -887,13 +900,14 @@ gaim_markup_html_to_xhtml(const char *ht p++; } c = strchr(c, '>') + 1; - if(style->len) { - pt = g_new0(struct gaim_parse_tag, 1); - pt->src_tag = "font"; - pt->dest_tag = "span"; - tags = g_list_prepend(tags, pt); + pt = g_new0(struct gaim_parse_tag, 1); + pt->src_tag = "font"; + pt->dest_tag = "span"; + tags = g_list_prepend(tags, pt); + if(style->len) g_string_append_printf(xhtml, "<span style='%s'>", style->str); - } + else + pt->ignore = TRUE; g_string_free(style, TRUE); continue; } @@ -994,7 +1008,9 @@ gaim_markup_html_to_xhtml(const char *ht } tag = tags; while(tag) { - g_string_append_printf(xhtml, "</%s>", (char *)tag->data); + struct gaim_parse_tag *pt = tag->data; + if(!pt->ignore) + g_string_append_printf(xhtml, "</%s>", pt->dest_tag); tag = tag->next; } g_list_free(tags); |