# HG changeset patch # User Nathan Walp # Date 1073759927 0 # Node ID 9b6bc1010054e562fd040665d7e2c8130c38616b # Parent f1822a0c103a01a4e46a02a9bb9ff4b330bdd699 [gaim-migrate @ 8757] this fixes some things gtkimhtml seems to have trouble with foreground colors, maybe, i think committer: Tailor Script diff -r f1822a0c103a -r 9b6bc1010054 src/util.c --- a/src/util.c Sat Jan 10 18:13:52 2004 +0000 +++ b/src/util.c Sat Jan 10 18:38:47 2004 +0000 @@ -652,6 +652,7 @@ 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 @@ 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 @@ 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, "", style->str); - } + else + pt->ignore = TRUE; g_string_free(style, TRUE); continue; } @@ -994,7 +1008,9 @@ } tag = tags; while(tag) { - g_string_append_printf(xhtml, "", (char *)tag->data); + struct gaim_parse_tag *pt = tag->data; + if(!pt->ignore) + g_string_append_printf(xhtml, "", pt->dest_tag); tag = tag->next; } g_list_free(tags);