[PATCH 1/4] Add the option "--reply-to" to notmuch reply.

Mark Walters markwalters1009 at gmail.com
Sun Jan 8 07:08:20 PST 2012


On Sun, 08 Jan 2012 14:47:33 +0200, Jani Nikula <jani at nikula.org> wrote:
> > +	/* We add the addresses if we are replying to all or we have not yet found
> > +	 * a non-user address. We have to keep parsing to make sure we do find the
> > +	 * correct from address for the user, but we pass a NULL message
> > +	 */
> > +	if ((reply_to_all) || (g_mime_message_get_all_recipients (reply) == NULL))
> 
> Looking into this, it occurred to me g_mime_message_get_all_recipients()
> allocates a new InternetAddressList when the return value is
> non-NULL. Thus this leaks memory. OTOH allocating and deallocating for
> this purpose seems suboptimal. I'll think this over.

If we are happy with reply-to-sender stopping at the to: line
(so if you reply-to-sender to an email which you sent and has no-one
(apart from possibly you) on the to: line it would not give any
recipients) then we only have two cases and we could do something like

add_recipients_for_string for reply-to:/from:

if return value is non-null then we were the sender so then

add_recipients_for_string for to:

and then stop regardless (well we want to carry on parsing headers to
find the correct from: address to use but not adding any more
recipients).

It feels a bit hackish (it relies on the fact that if we found our
address in the Reply-to:/From: line we didn't find anyone else's
address). 

I think replying to an email which we sent and which does not have any
other person on the to: line is sufficiently rare that it doesn't really
matter what we do in this case.

Best wishes

Mark


More information about the notmuch mailing list