| 1367 struct purple_parse_tag *pt = tags->data; |
1367 struct purple_parse_tag *pt = tags->data; |
| 1368 if(xhtml) |
1368 if(xhtml) |
| 1369 g_string_append_printf(xhtml, "</%s>", pt->dest_tag); |
1369 g_string_append_printf(xhtml, "</%s>", pt->dest_tag); |
| 1370 if(plain && !strcmp(pt->src_tag, "a")) { |
1370 if(plain && !strcmp(pt->src_tag, "a")) { |
| 1371 /* if this is a link, we have to add the url to the plaintext, too */ |
1371 /* if this is a link, we have to add the url to the plaintext, too */ |
| 1372 if (cdata && url && !g_string_equal(cdata, url)) |
1372 if (cdata && url && |
| |
1373 (!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 || |
| |
1374 g_utf8_collate(url->str + 7, cdata->str) != 0))) |
| 1373 g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); |
1375 g_string_append_printf(plain, " <%s>", g_strstrip(url->str)); |
| 1374 if (cdata) { |
1376 if (cdata) { |
| 1375 g_string_free(cdata, TRUE); |
1377 g_string_free(cdata, TRUE); |
| 1376 cdata = NULL; |
1378 cdata = NULL; |
| 1377 } |
1379 } |
| 1727 } |
1729 } |
| 1728 if(xhtml) |
1730 if(xhtml) |
| 1729 xhtml = g_string_append_len(xhtml, c, len); |
1731 xhtml = g_string_append_len(xhtml, c, len); |
| 1730 if(plain) |
1732 if(plain) |
| 1731 plain = g_string_append(plain, pln); |
1733 plain = g_string_append(plain, pln); |
| |
1734 if(cdata) |
| |
1735 cdata = g_string_append_len(cdata, c, len); |
| 1732 c += len; |
1736 c += len; |
| 1733 } else { |
1737 } else { |
| 1734 if(xhtml) |
1738 if(xhtml) |
| 1735 xhtml = g_string_append_c(xhtml, *c); |
1739 xhtml = g_string_append_c(xhtml, *c); |
| 1736 if(plain) |
1740 if(plain) |
| 1752 *xhtml_out = g_string_free(xhtml, FALSE); |
1756 *xhtml_out = g_string_free(xhtml, FALSE); |
| 1753 if(plain_out) |
1757 if(plain_out) |
| 1754 *plain_out = g_string_free(plain, FALSE); |
1758 *plain_out = g_string_free(plain, FALSE); |
| 1755 if(url) |
1759 if(url) |
| 1756 g_string_free(url, TRUE); |
1760 g_string_free(url, TRUE); |
| |
1761 if (cdata) |
| |
1762 g_string_free(cdata, TRUE); |
| 1757 } |
1763 } |
| 1758 |
1764 |
| 1759 /* The following are probably reasonable changes: |
1765 /* The following are probably reasonable changes: |
| 1760 * - \n should be converted to a normal space |
1766 * - \n should be converted to a normal space |
| 1761 * - in addition to <br>, <p> and <div> etc. should also be converted into \n |
1767 * - in addition to <br>, <p> and <div> etc. should also be converted into \n |