[evolution/gnome-3-20] Bug 767780 - The "References" header folded twice



commit bc61bf9d9c790ca02f174d5f14d3e21910fcc6ae
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jun 21 10:26:52 2016 +0200

    Bug 767780 - The "References" header folded twice

 composer/e-msg-composer.c   |    2 +-
 mail/em-composer-utils.c    |   15 +++++++++++----
 modules/mdn/evolution-mdn.c |   19 +++++++++++--------
 3 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index f8ec954..4adbf4a 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -4048,7 +4048,7 @@ e_msg_composer_new_with_message (EShell *shell,
                                g_strdup (headers->name));
                        g_ptr_array_add (
                                composer->priv->extra_hdr_values,
-                               g_strdup (headers->value));
+                               camel_header_unfold (headers->value));
                }
 
                headers = headers->next;
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index d316b57..82cad5e 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1990,6 +1990,7 @@ emu_add_composer_references_from_message (EMsgComposer *composer,
                GString *references = g_string_new ("");
                gint ii = 0;
                const gchar *value;
+               gchar *unfolded;
 
                while (value = e_msg_composer_get_header (composer, "References", ii), value) {
                        ii++;
@@ -2010,9 +2011,12 @@ emu_add_composer_references_from_message (EMsgComposer *composer,
                if (*message_id_header != '<')
                        g_string_append_c (references, '>');
 
-               e_msg_composer_set_header (composer, "References", references->str);
+               unfolded = camel_header_unfold (references->str);
+
+               e_msg_composer_set_header (composer, "References", unfolded);
 
                g_string_free (references, TRUE);
+               g_free (unfolded);
        }
 }
 
@@ -2455,7 +2459,7 @@ reply_get_composer (EShell *shell,
                    const gchar *message_uid,
                     CamelNNTPAddress *postto)
 {
-       const gchar *message_id, *references;
+       gchar *message_id, *references;
        EDestination **tov, **ccv;
        EMsgComposer *composer;
        EComposerHeaderTable *table;
@@ -2544,8 +2548,8 @@ reply_get_composer (EShell *shell,
        /* Add In-Reply-To and References. */
 
        medium = CAMEL_MEDIUM (message);
-       message_id = camel_medium_get_header (medium, "Message-ID");
-       references = camel_medium_get_header (medium, "References");
+       message_id = camel_header_unfold (camel_medium_get_header (medium, "Message-ID"));
+       references = camel_header_unfold (camel_medium_get_header (medium, "References"));
 
        if (message_id != NULL) {
                gchar *reply_refs;
@@ -2568,6 +2572,9 @@ reply_get_composer (EShell *shell,
                        composer, "References", references);
        }
 
+       g_free (message_id);
+       g_free (references);
+
        return composer;
 }
 
diff --git a/modules/mdn/evolution-mdn.c b/modules/mdn/evolution-mdn.c
index 0a46204..27b9711 100644
--- a/modules/mdn/evolution-mdn.c
+++ b/modules/mdn/evolution-mdn.c
@@ -222,8 +222,8 @@ mdn_notify_sender (ESource *identity_source,
        EMailBackend *backend;
        EMailSession *session;
        ESourceExtension *extension;
-       const gchar *message_id;
-       const gchar *message_date;
+       gchar *message_id;
+       gchar *message_date;
        const gchar *message_subject;
        const gchar *extension_name;
        const gchar *transport_uid;
@@ -236,6 +236,8 @@ mdn_notify_sender (ESource *identity_source,
        gchar *content;
        gchar *ua;
 
+       g_return_if_fail (identity_source != NULL);
+
        backend = e_mail_reader_get_backend (reader);
        session = e_mail_backend_get_session (backend);
 
@@ -245,20 +247,18 @@ mdn_notify_sender (ESource *identity_source,
        camel_message_info_set_user_flag (info, MDN_USER_FLAG, TRUE);
 
        medium = CAMEL_MEDIUM (message);
-       message_id = camel_medium_get_header (medium, "Message-ID");
-       message_date = camel_medium_get_header (medium, "Date");
+       message_id = camel_header_unfold (camel_medium_get_header (medium, "Message-ID"));
+       message_date = camel_header_unfold (camel_medium_get_header (medium, "Date"));
        message_subject = camel_mime_message_get_subject (message);
 
        if (message_id == NULL)
-               message_id = "";
+               message_id = g_strdup ("");
 
        if (message_date == NULL)
-               message_date = "";
+               message_date = g_strdup ("");
 
        /* Collect information for the receipt. */
 
-       g_return_if_fail (identity_source != NULL);
-
        extension_name = E_SOURCE_EXTENSION_MAIL_IDENTITY;
        extension = e_source_get_extension (identity_source, extension_name);
 
@@ -416,6 +416,9 @@ mdn_notify_sender (ESource *identity_source,
                g_object_ref (session));
 
        camel_message_info_unref (receipt_info);
+
+       g_free (message_date);
+       g_free (message_id);
 }
 
 static void


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