[evolution] I#1447 - templates: Include In-Reply-To/References headers
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution] I#1447 - templates: Include In-Reply-To/References headers
- Date: Tue, 6 Apr 2021 13:18:52 +0000 (UTC)
commit 7c8fdde61014cb94d8283c3c219eaf3cbca4c437
Author: Milan Crha <mcrha redhat com>
Date: Tue Apr 6 15:18:07 2021 +0200
I#1447 - templates: Include In-Reply-To/References headers
Closes https://gitlab.gnome.org/GNOME/evolution/-/issues/1447
src/mail/e-mail-templates.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
---
diff --git a/src/mail/e-mail-templates.c b/src/mail/e-mail-templates.c
index 47fb3aafce..7466bccc8f 100644
--- a/src/mail/e-mail-templates.c
+++ b/src/mail/e-mail-templates.c
@@ -515,6 +515,7 @@ e_mail_templates_apply_sync (CamelMimeMessage *source_message,
CamelDataWrapper *dw;
const CamelNameValueArray *headers;
CamelMimePart *template_part = NULL;
+ gchar *references, *message_id;
guint ii, len;
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (source_message), NULL);
@@ -577,7 +578,10 @@ e_mail_templates_apply_sync (CamelMimeMessage *source_message,
continue;
if (g_ascii_strncasecmp (header_name, "content-", 8) != 0 &&
- g_ascii_strcasecmp (header_name, "from") != 0) {
+ g_ascii_strcasecmp (header_name, "from") != 0 &&
+ g_ascii_strcasecmp (header_name, "Message-ID") != 0 &&
+ g_ascii_strcasecmp (header_name, "In-Reply-To") != 0 &&
+ g_ascii_strcasecmp (header_name, "References") != 0) {
gchar *new_header_value = NULL;
/* Some special handling of the 'subject' header */
@@ -628,6 +632,32 @@ e_mail_templates_apply_sync (CamelMimeMessage *source_message,
if (camel_mime_message_get_reply_to (template_message))
camel_mime_message_set_reply_to (result_message, camel_mime_message_get_reply_to
(template_message));
+ /* Add In-Reply-To and References. */
+
+ message_id = camel_header_unfold (camel_medium_get_header (CAMEL_MEDIUM (source_message),
"Message-ID"));
+ references = camel_header_unfold (camel_medium_get_header (CAMEL_MEDIUM (source_message),
"References"));
+
+ if (message_id && *message_id) {
+ gchar *reply_refs;
+
+ camel_medium_add_header (CAMEL_MEDIUM (result_message), "In-Reply-To", message_id);
+
+ if (references)
+ reply_refs = g_strdup_printf ("%s %s", references, message_id);
+ else
+ reply_refs = NULL;
+
+ camel_medium_add_header (CAMEL_MEDIUM (result_message), "References", reply_refs ? reply_refs
: message_id);
+
+ g_free (reply_refs);
+
+ } else if (references && *references) {
+ camel_medium_add_header (CAMEL_MEDIUM (result_message), "References", references);
+ }
+
+ g_free (message_id);
+ g_free (references);
+
g_clear_object (&template_message);
g_clear_object (&new_multipart);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]