Mercurial > pidgin.yaz
comparison src/gtkimhtml.c @ 10865:c28766b87f64
[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 <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Sun, 24 Apr 2005 21:28:39 +0000 |
parents | a29815b897c0 |
children | 6240d7fd5b2c |
comparison
equal
deleted
inserted
replaced
10864:55e29b8e9689 | 10865:c28766b87f64 |
---|---|
1654 | 1654 |
1655 if (!t->values) | 1655 if (!t->values) |
1656 break; | 1656 break; |
1657 | 1657 |
1658 if(*x == '&' && gtk_imhtml_is_amp_escape(x, &, &alen)) { | 1658 if(*x == '&' && gtk_imhtml_is_amp_escape(x, &, &alen)) { |
1659 len += alen - strlen(amp); | 1659 gboolean matched = TRUE; |
1660 x += alen - strlen(amp); | 1660 /* Make sure all chars of the unescaped value match */ |
1661 pos = strchr (t->values->str, *amp); | 1661 while (*(amp + 1)) { |
1662 pos = strchr (t->values->str, *amp); | |
1663 if (pos) | |
1664 t = t->children [GPOINTER_TO_INT(pos) - GPOINTER_TO_INT(t->values->str)]; | |
1665 else { | |
1666 matched = FALSE; | |
1667 break; | |
1668 } | |
1669 amp++; | |
1670 } | |
1671 if (!matched) | |
1672 break; | |
1673 | |
1674 pos = strchr (t->values->str, *amp); | |
1662 } | 1675 } |
1663 else if (*x == '<') /* Because we're all WYSIWYG now, a '<' | 1676 else if (*x == '<') /* Because we're all WYSIWYG now, a '<' |
1664 * char should only appear as the start of a tag. Perhaps a safer (but costlier) | 1677 * char should only appear as the start of a tag. Perhaps a safer (but costlier) |
1665 * check would be to call gtk_imhtml_is_tag on it */ | 1678 * check would be to call gtk_imhtml_is_tag on it */ |
1666 break; | 1679 break; |
1667 else | 1680 else { |
1668 pos = strchr (t->values->str, *x); | 1681 alen = 1; |
1682 pos = strchr (t->values->str, *x); | |
1683 } | |
1669 | 1684 |
1670 if (pos) | 1685 if (pos) |
1671 t = t->children [GPOINTER_TO_INT(pos) - GPOINTER_TO_INT(t->values->str)]; | 1686 t = t->children [GPOINTER_TO_INT(pos) - GPOINTER_TO_INT(t->values->str)]; |
1672 else | 1687 else |
1673 break; | 1688 break; |
1674 | 1689 |
1675 x++; len++; | 1690 x += alen; |
1691 len += alen; | |
1676 } | 1692 } |
1677 | 1693 |
1678 if (t->image) | 1694 if (t->image) |
1679 return len; | 1695 return len; |
1680 | 1696 |