Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1CA1B431FCF for ; Mon, 1 Mar 2010 09:30:17 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.211 X-Spam-Level: X-Spam-Status: No, score=-2.211 tagged_above=-999 required=5 tests=[AWL=0.388, BAYES_00=-2.599] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1RBsKZm8EIwG for ; Mon, 1 Mar 2010 09:30:15 -0800 (PST) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 887F8431FC3 for ; Mon, 1 Mar 2010 09:30:15 -0800 (PST) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 64A7819F33C8; Mon, 1 Mar 2010 18:30:07 +0100 (CET) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id bNGhxSiZAReL; Mon, 1 Mar 2010 18:30:04 +0100 (CET) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id D7D5519F3376; Mon, 1 Mar 2010 18:30:04 +0100 (CET) Received: from localhost.localdomain (k335-30.felk.cvut.cz [147.32.86.30]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id C50EBFA003; Mon, 1 Mar 2010 18:30:04 +0100 (CET) From: Michal Sojka To: notmuch@notmuchmail.org Date: Mon, 1 Mar 2010 18:29:47 +0100 Message-Id: <1267464588-21050-1-git-send-email-sojkam1@fel.cvut.cz> X-Mailer: git-send-email 1.7.0 Subject: [notmuch] [PATCH 1/2] Allow replying only to sender X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2010 17:30:17 -0000 This adds --sender-only option to reply command, which makes the reply go only to the original sender. Signed-off-by: Michal Sojka --- 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