[RFC PATCH 6/6] cli/reply: only pass gmime message to add recipients to reply message
authorJani Nikula <jani@nikula.org>
Sun, 19 Jun 2016 20:15:34 +0000 (23:15 +0300)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 23:22:07 +0000 (16:22 -0700)
8e/077baa08b1ae5a4e80b5a7e864fbdbcc9e9ba0 [new file with mode: 0644]

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