This adds --sender-only option to reply command, which makes the reply go only to the original sender. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz> --- notmuch-reply.c | 9 +++++++-- notmuch.1 | 6 ++++++ notmuch.c | 3 +++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/notmuch-reply.c b/notmuch-reply.c index 98f6442..5814313 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -23,6 +23,8 @@ #include "notmuch-client.h" #include "gmime-filter-reply.h" +static notmuch_bool_t sender_only = FALSE; + static void reply_part_content (GMimeObject *part) { @@ -246,6 +248,7 @@ add_recipients_from_message (GMimeMessage *reply, }; const char *from_addr = NULL; unsigned int i; + unsigned int max; /* Some mailing lists munge the Reply-To header despite it being A Bad * Thing, see http://www.unicom.com/pw/reply-to-harmful.html @@ -262,8 +265,8 @@ add_recipients_from_message (GMimeMessage *reply, reply_to_map[0].header = "from"; reply_to_map[0].fallback = NULL; } - - for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) { + max = sender_only ? 1 : ARRAY_SIZE (reply_to_map); + for (i = 0; i < max; i++) { const char *addr, *recipients; recipients = notmuch_message_get_header (message, @@ -443,6 +446,8 @@ notmuch_reply_command (void *ctx, int argc, char *argv[]) fprintf (stderr, "Invalid value for --format: %s\n", opt); return 1; } + } else if (STRNCMP_LITERAL (argv[i], "--sender-only") == 0) { + sender_only = TRUE; } else { fprintf (stderr, "Unrecognized option: %s\n", argv[i]); return 1; diff --git a/notmuch.1 b/notmuch.1 index 282ad98..7220145 100644 --- a/notmuch.1 +++ b/notmuch.1 @@ -258,6 +258,12 @@ Includes subject and quoted message body. .BR headers-only Only produces In-Reply-To, References, To, Cc, and Bcc headers. .RE +.TP 4 +.B \-\-sender\-only + +Only setup the To: header as described above, not the additional Cc +headers. +.RE See the .B "SEARCH SYNTAX" diff --git a/notmuch.c b/notmuch.c index 87479f8..13df953 100644 --- a/notmuch.c +++ b/notmuch.c @@ -233,6 +233,9 @@ command_t commands[] = { "\t\t\t\tOnly produces In-Reply-To, References, To\n" "\t\t\t\tCc, and Bcc headers.\n" "\n" + "\t\t--sender-only\n" + "\t\t\tReply only to sender.\n" + "\n" "\t\tSee \"notmuch help search-terms\" for details of the search\n" "\t\tterms syntax." }, { "tag", notmuch_tag_command, -- 1.7.0