From 20f692fb88bfcad5557c2732c41e5b7977ffce21 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Mon, 18 Jun 2007 03:30:15 +0000 Subject: ** Fix for bug #330175 svn path=/trunk/; revision=33687 --- mail/em-folder-view.c | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) (limited to 'mail/em-folder-view.c') diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index b1a72f3be2..3fe1db0aea 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -1514,6 +1514,44 @@ emfv_message_post_reply (BonoboUIComponent *uic, void *data, const char *path) em_utils_post_reply_to_message_by_uid (emfv->folder, emfv->list->cursor_uid); } +static gboolean +html_contains_nonwhitespace (const char *html, gint len) +{ + const char *p; + gunichar c = 0; + + if (!html || len<=0) + return FALSE; + + p = html; + + while (p && p - html < len) { + c = g_utf8_get_char (p); + if (!c) + break; + + if (c == '<') { + /* skip until next '>' */ + while (c = g_utf8_get_char (p), c && c != '>' && p - html < len) + p = g_utf8_next_char (p); + if (!c) + break; + }else if (c == '&') { + /* sequence ' ' is a space */ + if (g_ascii_strncasecmp (p, " ", 6) == 0) + p = p + 5; + else + break; + }else if (!g_unichar_isspace (c)) { + break; + } + + p = g_utf8_next_char (p); + } + + return p - html < len - 1 && c != 0; +} + static void emfv_message_reply(EMFolderView *emfv, int mode) { @@ -1528,7 +1566,7 @@ emfv_message_reply(EMFolderView *emfv, int mode) if (gtk_html_command(((EMFormatHTML *)emfv->preview)->html, "is-selection-active") && (html = gtk_html_get_selection_html (((EMFormatHTML *)emfv->preview)->html, &len)) - && len && html[0]) { + && len && html[0] && html_contains_nonwhitespace (html, len)) { CamelMimeMessage *msg, *src; struct _camel_header_raw *header; -- cgit