Mercurial > pidgin
changeset 8440:be172fe866ac
[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 <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 14 Mar 2004 05:37:41 +0000 |
parents | b08d8874d933 |
children | ea999c4a9a11 |
files | src/protocols/yahoo/util.c |
diffstat | 1 files changed, 32 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- 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", "</I>"); g_hash_table_insert(ht, "4", "<U>"); g_hash_table_insert(ht, "x4", "</U>"); - g_hash_table_insert(ht, "</font>", "</font>"); /* 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, "</b>", "</b>"); g_hash_table_insert(ht, "</i>", "</i>"); g_hash_table_insert(ht, "</u>", "</u>"); + g_hash_table_insert(ht, "</font>", "</font>"); } 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]); + } } }