[PATCH v2 2/3] reply: add message-id header

Subject: [PATCH v2 2/3] reply: add message-id header

Date: Wed, 18 Apr 2012 15:39:12 +0300

To: notmuch@notmuchmail.org

Cc:

From: Felipe Contreras


Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 notmuch-reply.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/notmuch-reply.c b/notmuch-reply.c
index 0949d9f..d796bb2 100644
--- a/notmuch-reply.c
+++ b/notmuch-reply.c
@@ -464,6 +464,8 @@ create_reply_message(void *ctx,
 {
     const char *subject, *from_addr = NULL;
     const char *in_reply_to, *orig_references, *references;
+    const char *message_id;
+    char *simple_from;
 
     /* The 1 means we want headers in a "pretty" order. */
     GMimeMessage *reply = g_mime_message_new (1);
@@ -488,6 +490,8 @@ create_reply_message(void *ctx,
     if (from_addr == NULL)
 	from_addr = notmuch_config_get_user_primary_email (config);
 
+    simple_from = talloc_strdup (ctx, from_addr);
+
     from_addr = talloc_asprintf (ctx, "%s <%s>",
 				 notmuch_config_get_user_name (config),
 				 from_addr);
@@ -508,6 +512,13 @@ create_reply_message(void *ctx,
     g_mime_object_set_header (GMIME_OBJECT (reply),
 			      "References", references);
 
+    message_id = talloc_asprintf (ctx, "<%lu-notmuch-%s>",
+				  time(NULL),
+				  simple_from);
+    g_mime_object_set_header (GMIME_OBJECT (reply),
+			      "Message-ID", message_id);
+    talloc_free (simple_from);
+
     return reply;
 }
 
-- 
1.7.10


Thread: