[evolution/gnome-3-20] EHTMLEditorView - Remove signature from Thunderbird if presented



commit 996478fe396ef1661bb551629ce7acc6e72366db
Author: Tomas Popela <tpopela redhat com>
Date:   Wed Mar 30 10:10:13 2016 +0200

    EHTMLEditorView - Remove signature from Thunderbird if presented
    
    It is easier to remove it once we have an access to DOM than doing our own HTML
    parses in the stripsig filter.

 e-util/e-html-editor-view.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/e-util/e-html-editor-view.c b/e-util/e-html-editor-view.c
index 2cccd76..2fd51b0 100644
--- a/e-util/e-html-editor-view.c
+++ b/e-util/e-html-editor-view.c
@@ -1381,6 +1381,17 @@ repair_gmail_blockquotes (WebKitDOMDocument *document)
        g_object_unref (list);
 }
 
+static void
+remove_thunderbird_signature (WebKitDOMDocument *document)
+{
+       WebKitDOMElement *signature;
+
+       signature = webkit_dom_document_query_selector (
+               document, "pre.moz-signature", NULL);
+       if (signature)
+               remove_node (WEBKIT_DOM_NODE (signature));
+}
+
 /* Based on original use_pictograms() from GtkHTML */
 static const gchar *emoticons_chars =
        /*  0 */ "DO)(|/PQ*!"
@@ -8305,6 +8316,7 @@ html_editor_convert_view_content (EHTMLEditorView *view,
        g_object_unref (list);
 
        repair_gmail_blockquotes (document);
+       remove_thunderbird_signature (document);
        create_text_markers_for_citations_in_element (WEBKIT_DOM_ELEMENT (body));
 
        if (preferred_text && *preferred_text)
@@ -11053,6 +11065,7 @@ html_editor_view_load_status_changed (EHTMLEditorView *view)
        put_body_in_citation (document);
        move_elements_to_body (view);
        repair_gmail_blockquotes (document);
+       remove_thunderbird_signature (document);
 
        if (webkit_dom_element_has_attribute (WEBKIT_DOM_ELEMENT (body), "data-evo-draft")) {
                /* Restore the selection how it was when the draft was saved */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]