# HG changeset patch # User Daniel Atallah # Date 1114378119 0 # Node ID c28766b87f64f1e1b3ea4ef2ccda4be62320ed2a # Parent 55e29b8e9689182259b61b157b2ba686eda87d71 [gaim-migrate @ 12549] Check all characters in the unescaped value of a HTML entity when matching smileys. Also make sure that the returned value of the smiley length is correct when dealing with escaped text. This resolves an inconsistency between how smileys are detected and how they are looked up for display. committer: Tailor Script diff -r 55e29b8e9689 -r c28766b87f64 src/gtkimhtml.c --- a/src/gtkimhtml.c Sun Apr 24 21:26:33 2005 +0000 +++ b/src/gtkimhtml.c Sun Apr 24 21:28:39 2005 +0000 @@ -1656,23 +1656,39 @@ break; if(*x == '&' && gtk_imhtml_is_amp_escape(x, &, &alen)) { - len += alen - strlen(amp); - x += alen - strlen(amp); - pos = strchr (t->values->str, *amp); + gboolean matched = TRUE; + /* Make sure all chars of the unescaped value match */ + while (*(amp + 1)) { + pos = strchr (t->values->str, *amp); + if (pos) + t = t->children [GPOINTER_TO_INT(pos) - GPOINTER_TO_INT(t->values->str)]; + else { + matched = FALSE; + break; + } + amp++; + } + if (!matched) + break; + + pos = strchr (t->values->str, *amp); } else if (*x == '<') /* Because we're all WYSIWYG now, a '<' * char should only appear as the start of a tag. Perhaps a safer (but costlier) * check would be to call gtk_imhtml_is_tag on it */ break; - else - pos = strchr (t->values->str, *x); + else { + alen = 1; + pos = strchr (t->values->str, *x); + } if (pos) t = t->children [GPOINTER_TO_INT(pos) - GPOINTER_TO_INT(t->values->str)]; else break; - x++; len++; + x += alen; + len += alen; } if (t->image)