[evolution] Bug 759474 - Attachment Reminder plugin should ignore quoted message text
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] Bug 759474 - Attachment Reminder plugin should ignore quoted message text
- Date: Wed, 10 Feb 2016 22:03:08 +0000 (UTC)
commit 8b8b15bf47aa9e656de7ae9628c0b6985b297b9c
Author: Milan Crha <mcrha redhat com>
Date: Wed Feb 10 23:02:27 2016 +0100
Bug 759474 - Attachment Reminder plugin should ignore quoted message text
composer/e-msg-composer.c | 18 +++++++++++++-----
plugins/attachment-reminder/attachment-reminder.c | 19 +++++++++++++++++++
2 files changed, 32 insertions(+), 5 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 617f94e..e3a242c 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -5593,13 +5593,21 @@ e_msg_composer_get_raw_message_text_without_signature (EMsgComposer *composer)
document, "body > *:not(.-x-evo-signature-wrapper)", NULL);
length = webkit_dom_node_list_get_length (list);
for (ii = 0; ii < length; ii++) {
- gchar *text;
WebKitDOMNode *node = webkit_dom_node_list_item (list, ii);
- text = webkit_dom_html_element_get_inner_text (
- WEBKIT_DOM_HTML_ELEMENT (node));
- g_byte_array_append (array, (guint8 *) text, strlen (text));
- g_free (text);
+ if (!WEBKIT_DOM_IS_HTML_QUOTE_ELEMENT (node)) {
+ gchar *text;
+
+ text = webkit_dom_html_element_get_inner_text (WEBKIT_DOM_HTML_ELEMENT (node));
+ g_byte_array_append (array, (guint8 *) text, strlen (text));
+ g_free (text);
+
+ if (WEBKIT_DOM_IS_HTML_DIV_ELEMENT (node))
+ g_byte_array_append (array, (const guint8 *) "\n", 1);
+ else
+ g_byte_array_append (array, (const guint8 *) " ", 1);
+ }
+
g_object_unref (node);
}
diff --git a/plugins/attachment-reminder/attachment-reminder.c
b/plugins/attachment-reminder/attachment-reminder.c
index 4966b21..0031c63 100644
--- a/plugins/attachment-reminder/attachment-reminder.c
+++ b/plugins/attachment-reminder/attachment-reminder.c
@@ -140,6 +140,23 @@ ask_for_missing_attachment (EPlugin *ep,
return response == GTK_RESPONSE_YES;
}
+static void
+censor_quoted_lines (GByteArray *msg_text)
+{
+ gchar *ptr;
+ gboolean in_quotation = FALSE;
+
+ g_return_if_fail (msg_text != NULL);
+
+ for (ptr = (char *) msg_text->data; ptr && *ptr; ptr++) {
+ if (*ptr == '\n') {
+ in_quotation = ptr[1] == '>';
+ } else if (*ptr != '\r' && in_quotation) {
+ *ptr = ' ';
+ }
+ }
+}
+
/* check for the clues */
static gboolean
check_for_attachment_clues (GByteArray *msg_text)
@@ -160,6 +177,8 @@ check_for_attachment_clues (GByteArray *msg_text)
g_byte_array_append (msg_text, (const guint8 *) "\0", 1);
+ censor_quoted_lines (msg_text);
+
for (ii = 0; clue_list[ii] && !found; ii++) {
GString *word;
const gchar *clue = clue_list[ii];
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]