changeset 21274:b3c6d817d68d

Close #2810. ('Non-XHTML-IM messages with links in them are broken.')
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 30 Oct 2007 10:15:58 +0000
parents 6e666ae6f68e
children 36377c25417d
files libpurple/util.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/util.c	Tue Oct 30 09:55:47 2007 +0000
+++ b/libpurple/util.c	Tue Oct 30 10:15:58 2007 +0000
@@ -1372,7 +1372,9 @@
 							g_string_append_printf(xhtml, "</%s>", pt->dest_tag);
 						if(plain && !strcmp(pt->src_tag, "a")) {
 							/* if this is a link, we have to add the url to the plaintext, too */
-							if (cdata && url && !g_string_equal(cdata, url))
+							if (cdata && url &&
+									(!g_string_equal(cdata, url) && (g_ascii_strncasecmp(url->str, "mailto:", 7) != 0 ||
+									                                 g_utf8_collate(url->str + 7, cdata->str) != 0)))
 								g_string_append_printf(plain, " <%s>", g_strstrip(url->str));
 							if (cdata) {
 								g_string_free(cdata, TRUE);
@@ -1732,6 +1734,8 @@
 				xhtml = g_string_append_len(xhtml, c, len);
 			if(plain)
 				plain = g_string_append(plain, pln);
+			if(cdata)
+				cdata = g_string_append_len(cdata, c, len);
 			c += len;
 		} else {
 			if(xhtml)
@@ -1757,6 +1761,8 @@
 		*plain_out = g_string_free(plain, FALSE);
 	if(url)
 		g_string_free(url, TRUE);
+	if (cdata)
+		g_string_free(cdata, TRUE);
 }
 
 /* The following are probably reasonable changes: