From: Jani Nikula Date: Sun, 19 Jun 2016 20:15:34 +0000 (+0300) Subject: [RFC PATCH 6/6] cli/reply: only pass gmime message to add recipients to reply message X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=5f0fb461c8a60b12ee5f92388828826e7a6bee3c;p=notmuch-archives.git [RFC PATCH 6/6] cli/reply: only pass gmime message to add recipients to reply message --- diff --git a/8e/077baa08b1ae5a4e80b5a7e864fbdbcc9e9ba0 b/8e/077baa08b1ae5a4e80b5a7e864fbdbcc9e9ba0 new file mode 100644 index 000000000..787013692 --- /dev/null +++ b/8e/077baa08b1ae5a4e80b5a7e864fbdbcc9e9ba0 @@ -0,0 +1,188 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id B68B76DE0936 + for ; Sun, 19 Jun 2016 13:17:34 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +X-Spam-Flag: NO +X-Spam-Score: 0.441 +X-Spam-Level: +X-Spam-Status: No, score=0.441 tagged_above=-999 required=5 tests=[AWL=1.161, + DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, + RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ha1sZq0KO2DG for ; + Sun, 19 Jun 2016 13:17:26 -0700 (PDT) +Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com + [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id 35DAA6DE00B8 for + ; Sun, 19 Jun 2016 13:17:11 -0700 (PDT) +Received: by mail-wm0-f66.google.com with SMTP id 187so9592784wmz.1 + for ; Sun, 19 Jun 2016 13:17:11 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=nikula-org.20150623.gappssmtp.com; s=20150623; + h=from:to:cc:subject:date:message-id:in-reply-to:references + :in-reply-to:references; + bh=sXFKrcZlopHTqxt+2oZpuv7kSjYwfHt0jv/D1LfLMiA=; + b=X7OiwJaJd0Os+qQ+SooA92hb2Qk2t8tMzSa+AsiZ0up75GoCSn4svfXHpP6PLizZZB + hpyLKXI0iekrjQbsmgd57zskXWlA/o+V3OXDnC4YZxLnv5kktVsf6f5jESVxhn2X9a3V + mCpZHmFcL+n1pxuwoQ2mz0cfyqFcjB+hs8/h1i4rKs+fLo7sKYcCDNes+ySUvNXjQBck + QahSamIe3wn3RDxXb0UbBbv0JfMj0K/4TMWj3G6b0HiRQHfU1Aqi/MUfjahW4+VToljl + AqfUXbV1c1AKBNx23Ol2QTeF86ZM4IWNOHqa6N44K9zbl+kB9hQMUZ1uOYZ8TMOEi1G1 + jXiQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:in-reply-to:references; + bh=sXFKrcZlopHTqxt+2oZpuv7kSjYwfHt0jv/D1LfLMiA=; + b=H78Lt7xgDy7CbLxitQjer98W0KUrRFMOCYOnHS8Zmv7PawpgBkro4EN7/gurbB1yne + TC9egsXrIjEf6mPmn3tyi5Kn8KyxIlqKndfzi2NDxRThYs22z7tLbJGBujqitSIVb91b + 7Mxiv28TT4naDEc7cLGUvXLpJOvdt8zhPUFhsQLYPnBcokfhGlVyTMhsrlRWfT0NlfdM + rZE9sJj0MkU9z2qG0WynlPdSPFvj7hWe6FbNmOOC1CWo5GA/ntrGBGB8z5pCl0oCUw4o + NtXQGR5hHB3YRBEOAIDheE0vL8ysSQgwooBu0qEE7Dbm/Y4Tu4rtgePiy/KRmMKRVMEh + GsvA== +X-Gm-Message-State: + ALyK8tIHsNND7WywtHZLh/rLcxZTKYcntAFDK8TWlQ0e6oCy5cMP+/HTNagKu20MgIF2oQ== +X-Received: by 10.194.23.226 with SMTP id p2mr11192110wjf.120.1466367429812; + Sun, 19 Jun 2016 13:17:09 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c37a-44.dhcp.inet.fi. + [88.195.122.44]) + by smtp.gmail.com with ESMTPSA id b187sm8321811wmg.15.2016.06.19.13.17.09 + (version=TLSv1/SSLv3 cipher=OTHER); + Sun, 19 Jun 2016 13:17:09 -0700 (PDT) +From: Jani Nikula +To: Jani Nikula , + notmuch@notmuchmail.org +Cc: Daniel Kahn Gillmor +Subject: [RFC PATCH 6/6] cli/reply: only pass gmime message to add recipients + to reply message +Date: Sun, 19 Jun 2016 23:15:34 +0300 +Message-Id: + +X-Mailer: git-send-email 2.1.4 +In-Reply-To: +References: + +In-Reply-To: +References: +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Sun, 19 Jun 2016 20:17:34 -0000 + +The notmuch message is no longer needed. Simplify. +--- + notmuch-reply.c | 37 ++++++++++++++----------------------- + 1 file changed, 14 insertions(+), 23 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index abf3a6c1824c..8c894974485d 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -272,12 +272,11 @@ reply_to_header_is_redundant (GMimeMessage *message, + return ret; + } + +-static InternetAddressList *get_sender(notmuch_message_t *message, +- GMimeMessage *mime_message) ++static InternetAddressList *get_sender(GMimeMessage *message) + { + const char *reply_to; + +- reply_to = g_mime_message_get_reply_to (mime_message); ++ reply_to = g_mime_message_get_reply_to (message); + if (reply_to && *reply_to) { + InternetAddressList *reply_to_list; + +@@ -295,35 +294,29 @@ static InternetAddressList *get_sender(notmuch_message_t *message, + * will always appear in the reply if reply_all is true. + */ + reply_to_list = internet_address_list_parse_string (reply_to); +- if (! reply_to_header_is_redundant (mime_message, reply_to_list)) ++ if (! reply_to_header_is_redundant (message, reply_to_list)) + return reply_to_list; + + g_object_unref (G_OBJECT (reply_to_list)); + } + + return internet_address_list_parse_string ( +- g_mime_message_get_sender (mime_message)); ++ g_mime_message_get_sender (message)); + } + +-static InternetAddressList *get_to(unused(notmuch_message_t *message), +- GMimeMessage *mime_message) ++static InternetAddressList *get_to(GMimeMessage *message) + { +- return g_mime_message_get_recipients (mime_message, +- GMIME_RECIPIENT_TYPE_TO); ++ return g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_TO); + } + +-static InternetAddressList *get_cc(unused(notmuch_message_t *message), +- GMimeMessage *mime_message) ++static InternetAddressList *get_cc(GMimeMessage *message) + { +- return g_mime_message_get_recipients (mime_message, +- GMIME_RECIPIENT_TYPE_CC); ++ return g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_CC); + } + +-static InternetAddressList *get_bcc(unused(notmuch_message_t *message), +- GMimeMessage *mime_message) ++static InternetAddressList *get_bcc(GMimeMessage *message) + { +- return g_mime_message_get_recipients (mime_message, +- GMIME_RECIPIENT_TYPE_BCC); ++ return g_mime_message_get_recipients (message, GMIME_RECIPIENT_TYPE_BCC); + } + + /* Augment the recipients of 'reply' from the "Reply-to:", "From:", +@@ -341,13 +334,11 @@ static InternetAddressList *get_bcc(unused(notmuch_message_t *message), + static const char * + add_recipients_from_message (GMimeMessage *reply, + notmuch_config_t *config, +- notmuch_message_t *message, +- GMimeMessage *mime_message, ++ GMimeMessage *message, + notmuch_bool_t reply_all) + { + struct { +- InternetAddressList * (*get_header)(notmuch_message_t *message, +- GMimeMessage *mime_message); ++ InternetAddressList * (*get_header)(GMimeMessage *message); + GMimeRecipientType recipient_type; + } reply_to_map[] = { + { get_sender, GMIME_RECIPIENT_TYPE_TO }, +@@ -362,7 +353,7 @@ add_recipients_from_message (GMimeMessage *reply, + for (i = 0; i < ARRAY_SIZE (reply_to_map); i++) { + InternetAddressList *recipients; + +- recipients = reply_to_map[i].get_header (message, mime_message); ++ recipients = reply_to_map[i].get_header (message); + + n += scan_address_list (recipients, config, reply, + reply_to_map[i].recipient_type, &from_addr); +@@ -567,7 +558,7 @@ create_reply_message(void *ctx, + + g_mime_object_set_header (GMIME_OBJECT (reply), "References", references); + +- from_addr = add_recipients_from_message (reply, config, message, ++ from_addr = add_recipients_from_message (reply, config, + mime_message, reply_all); + + /* The above is all that is needed for limited headers. */ +-- +2.1.4 +