# HG changeset patch # User Luke Schierer # Date 1079242661 0 # Node ID be172fe866acccda546b173cc2eee88dd5d5fcd3 # Parent b08d8874d933f36ad048e36fc6f50f324d53dd14 [gaim-migrate @ 9170] " This makes yahoo not send out html entities. This is because the official client will show them raw instead of parsing them. This also makes us show html entities raw, since that's how the other end meant them. This has some side effects if you type in something that's valid yahoo markup. The other end will probably see it as markup and render it as such, etc. Oh well, it's the way yahoo works. Better this than "everyone says i'm typing "!" (This isn't the patch Sean said to write. I still need to write that. This is sort of related though.)" --marv committer: Tailor Script diff -r b08d8874d933 -r be172fe866ac src/protocols/yahoo/util.c --- a/src/protocols/yahoo/util.c Sun Mar 14 04:08:12 2004 +0000 +++ b/src/protocols/yahoo/util.c Sun Mar 14 05:37:41 2004 +0000 @@ -136,7 +136,6 @@ g_hash_table_insert(ht, "x2", ""); g_hash_table_insert(ht, "4", ""); g_hash_table_insert(ht, "x4", ""); - g_hash_table_insert(ht, "", ""); /* these just tell us the text they surround is supposed * to be a link. gaim figures that out on its own so we @@ -184,6 +183,7 @@ g_hash_table_insert(ht, "", ""); g_hash_table_insert(ht, "", ""); g_hash_table_insert(ht, "", ""); + g_hash_table_insert(ht, "", ""); } void yahoo_dest_colorht() @@ -315,6 +315,10 @@ g_string_append(s, "<"); else if (x[i] == '>') g_string_append(s, ">"); + else if (x[i] == '&') + g_string_append(s, "&"); + else if (x[i] == '"') + g_string_append(s, """); else g_string_append_c(s, x[i]); } @@ -537,6 +541,7 @@ char *ret, *esc; GQueue *colors, *tags; GQueue *ftattr = NULL; + gboolean no_more_specials = FALSE; colors = g_queue_new(); @@ -546,20 +551,23 @@ for (i = 0, len = strlen(src); i < len; i++) { - if (src[i] == '<') { + if (!no_more_specials && src[i] == '<') { j = i; while (1) { j++; if (j >= len) { /* no '>' */ - g_string_append_len(dest, &src[i], len - i); - i = len; - + g_string_append_c(dest, src[i]); + no_more_specials = TRUE; break; } if (src[j] == '<') { + /* FIXME: This doesn't convert outgoing entities. + * However, I suspect this case may never + * happen anymore because of the entities. + */ g_string_append_len(dest, &src[i], j - i); i = j - 1; if (ftattr) { @@ -605,6 +613,10 @@ } if (src[j] == '>') { + /* This has some problems like the FIXME for the + * '<' case. and like that case, I suspect the case + * that this has problems is won't happen anymore anyway. + */ int sublen = j - i - 1; if (sublen) { @@ -649,7 +661,21 @@ } } else { - g_string_append_c(dest, src[i]); + if (((len - i) >= 4) && !strncmp(&src[i], "<", 4)) { + g_string_append_c(dest, '<'); + i += 3; + } else if (((len - i) >= 4) && !strncmp(&src[i], ">", 4)) { + g_string_append_c(dest, '>'); + i += 3; + } else if (((len - i) >= 5) && !strncmp(&src[i], "&", 4)) { + g_string_append_c(dest, '&'); + i += 4; + } else if (((len - i) >= 6) && !strncmp(&src[i], """, 4)) { + g_string_append_c(dest, '"'); + i += 5; + } else { + g_string_append_c(dest, src[i]); + } } }