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

Jani Nikula jani at nikula.org
Wed Apr 18 06:09:50 PDT 2012


On Wed, 18 Apr 2012 15:39:12 +0300, Felipe Contreras <felipe.contreras at gmail.com> wrote:
> Signed-off-by: Felipe Contreras <felipe.contreras at 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);

This duplicates the problem in "notmuch compose", hinting that you
should probably have the message-id generation in one place only.

I do wonder whether the emacs ui / message mode will add a duplicate
message-id rather than override this.


BR,
Jani.

> +    g_mime_object_set_header (GMIME_OBJECT (reply),
> +			      "Message-ID", message_id);
> +    talloc_free (simple_from);
> +
>      return reply;
>  }
>  
> -- 
> 1.7.10
> 
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list