Mercurial > pidgin
comparison src/util.c @ 9777:8d891252f2ac
[gaim-migrate @ 10645]
URLs containing ' will open correctly. There was some over-zealous
double-quotation mark usage in gtknotify.c. That may have been my fault.
Also escape the URLs in debug and gaim_notify messages.
Also refactored gaim_escape_html() a tad bit. There is nothing wrong
with exiting out of a function early. In the abnormal case that
html==NULL, we just exit the function. It makes the meat of the function
nested one fewer level.
committer: Tailor Script <tailor@pidgin.im>
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Thu, 19 Aug 2004 01:45:30 +0000 |
| parents | 242a5a97c952 |
| children | 3e7e294f56f3 |
comparison
equal
deleted
inserted
replaced
| 9776:1e5ef71c9583 | 9777:8d891252f2ac |
|---|---|
| 1650 return tmp; | 1650 return tmp; |
| 1651 } | 1651 } |
| 1652 | 1652 |
| 1653 char * | 1653 char * |
| 1654 gaim_escape_html(const char *html) { | 1654 gaim_escape_html(const char *html) { |
| 1655 char *escaped = NULL; | 1655 const char *c = html; |
| 1656 | 1656 GString *ret = g_string_new(""); |
| 1657 if (html != NULL) { | 1657 |
| 1658 const char *c = html; | 1658 if (html == NULL) |
| 1659 GString *ret = g_string_new(""); | 1659 return NULL; |
| 1660 while (*c) { | 1660 |
| 1661 switch(*c) { | 1661 while (*c) { |
| 1662 case '&': | 1662 switch (*c) { |
| 1663 ret = g_string_append(ret, "&"); | 1663 case '&': |
| 1664 break; | 1664 ret = g_string_append(ret, "&"); |
| 1665 case '<': | 1665 break; |
| 1666 ret = g_string_append(ret, "<"); | 1666 case '<': |
| 1667 break; | 1667 ret = g_string_append(ret, "<"); |
| 1668 case '>': | 1668 break; |
| 1669 ret = g_string_append(ret, ">"); | 1669 case '>': |
| 1670 break; | 1670 ret = g_string_append(ret, ">"); |
| 1671 case '"': | 1671 break; |
| 1672 ret = g_string_append(ret, """); | 1672 case '"': |
| 1673 break; | 1673 ret = g_string_append(ret, """); |
| 1674 default: | 1674 break; |
| 1675 ret = g_string_append_c(ret, *c); | 1675 default: |
| 1676 } | 1676 ret = g_string_append_c(ret, *c); |
| 1677 c++; | 1677 } |
| 1678 } | 1678 c++; |
| 1679 | 1679 } |
| 1680 escaped = ret->str; | 1680 |
| 1681 g_string_free(ret, FALSE); | 1681 return g_string_free(ret, FALSE); |
| 1682 } | |
| 1683 | |
| 1684 return escaped; | |
| 1685 } | 1682 } |
| 1686 | 1683 |
| 1687 char * | 1684 char * |
| 1688 gaim_unescape_html(const char *html) { | 1685 gaim_unescape_html(const char *html) { |
| 1689 char *unescaped = NULL; | 1686 char *unescaped = NULL; |
