[PATCH v3 0/3] Clean up reply's encoding story
authorAustin Clements <amdragon@MIT.EDU>
Fri, 16 Aug 2013 15:35:40 +0000 (11:35 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:56:20 +0000 (09:56 -0800)
1f/84e71fe9cd67340c229d78495c61ccb5c7a169 [new file with mode: 0644]

diff --git a/1f/84e71fe9cd67340c229d78495c61ccb5c7a169 b/1f/84e71fe9cd67340c229d78495c61ccb5c7a169
new file mode 100644 (file)
index 0000000..29d9d8f
--- /dev/null
@@ -0,0 +1,116 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id E5422429E40\r
+       for <notmuch@notmuchmail.org>; Fri, 16 Aug 2013 08:35:53 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id tJCi1ZW4vxyM for <notmuch@notmuchmail.org>;\r
+       Fri, 16 Aug 2013 08:35:48 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu\r
+       [18.7.68.37])\r
+       by olra.theworths.org (Postfix) with ESMTP id 5B9E7431E82\r
+       for <notmuch@notmuchmail.org>; Fri, 16 Aug 2013 08:35:48 -0700 (PDT)\r
+X-AuditID: 12074425-b7f0c8e000000953-af-520e46d3022d\r
+Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
+       by dmz-mailsec-scanner-8.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 4C.B5.02387.3D64E025; Fri, 16 Aug 2013 11:35:47 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+       by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r7GFZkor018110; \r
+       Fri, 16 Aug 2013 11:35:46 -0400\r
+Received: from drake.dyndns.org\r
+       (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com\r
+       [216.15.114.40]) (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r7GFZid7020140\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Fri, 16 Aug 2013 11:35:45 -0400\r
+Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1VAM40-0002vW-5t; Fri, 16 Aug 2013 11:35:44 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 0/3] Clean up reply's encoding story\r
+Date: Fri, 16 Aug 2013 11:35:40 -0400\r
+Message-Id: <1376667343-10863-1-git-send-email-amdragon@mit.edu>\r
+X-Mailer: git-send-email 1.7.10.4\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFlrNIsWRmVeSWpSXmKPExsUixCmqrXvZjS/IoGOTocWefV4W12/OZLZ4\r
+       s3IeqwOzx93TXB6Hvy5k8Xi26hZzAHMUl01Kak5mWWqRvl0CV8a5J9uZCk7wVkw/79LA+Jyr\r
+       i5GTQ0LARKJ1dxcbhC0mceHeejBbSGAfo8Slr6VdjFxA9kZGiW3NhxkhEneYJP6vK4JIzGWU\r
+       +LX9PwtIgk1AQ2Lb/uVgRSIC0hI7785mBbGZBYwkJt0/DhYXFjCXmPbtDZjNIqAq0XJnClgN\r
+       r4CDxMNPq1ggrlCU6H42gW0CI+8CRoZVjLIpuVW6uYmZOcWpybrFyYl5ealFuhZ6uZkleqkp\r
+       pZsYQWHC7qK6g3HCIaVDjAIcjEo8vAwTeYOEWBPLiitzDzFKcjApifLOc+QLEuJLyk+pzEgs\r
+       zogvKs1JLT7EKMHBrCTCu9UAKMebklhZlVqUD5OS5mBREud9/vRsoJBAemJJanZqakFqEUxW\r
+       hoNDSYJ3oStQo2BRanpqRVpmTglCmomDE2Q4D9DwPSA1vMUFibnFmekQ+VOMilLivM4gCQGQ\r
+       REZpHlwvLI5fMYoDvSLMewqkigeYAuC6XwENZgIaPOkML8jgkkSElFQD46GeHEcOLrWLLAe+\r
+       ZKbPOcLYZfD185VNzYXl3/9kPLgdrXp6feeeHNn9m7qq6pctTEtYfXOZG9etFfH3fDb/4zBf\r
+       GG/yq/dKy0f+4L8v7/y62zwxsWmy+Ur9r5euiiT//uvAtsr+a4rx45efn4sf0wt8tnWZZ0vB\r
+       WsFdm+UT+p5/ELshrFZf/1WJpTgj0VCLuag4EQDQ7en5vgIAAA==\r
+Cc: tomi.ollila@iki.fi\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 16 Aug 2013 15:35:54 -0000\r
+\r
+This is v3 of id:1376587658-19202-1-git-send-email-amdragon@mit.edu.\r
+This addresses Jani's comment in id:87k3jl3ehe.fsf@nikula.org by\r
+treating errors while retrieving the original message's References\r
+header as if the original message didn't have a References header.  It\r
+also adds a comment suggested by Jani on IRC.  The diff from v2 is\r
+below.\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index bfd0f51..ac46d02 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -31,6 +31,7 @@ show_reply_headers (GMimeMessage *message)\r
+     stream_stdout = g_mime_stream_file_new (stdout);\r
+     if (stream_stdout) {\r
+       g_mime_stream_file_set_owner (GMIME_STREAM_FILE (stream_stdout), FALSE);\r
++      /* Output RFC 2822 formatted (and RFC 2047 encoded) headers. */\r
+       g_mime_object_write_to_stream (GMIME_OBJECT(message), stream_stdout);\r
+       g_object_unref(stream_stdout);\r
+     }\r
+@@ -526,14 +527,15 @@ create_reply_message(void *ctx,\r
+                             "In-Reply-To", in_reply_to);\r
\r
+     orig_references = notmuch_message_get_header (message, "references");\r
+-    if (orig_references) {\r
+-      references = talloc_asprintf (ctx, "%s%s%s",\r
+-                                    *orig_references ? orig_references : "",\r
+-                                    *orig_references ? " " : "",\r
+-                                    in_reply_to);\r
+-      g_mime_object_set_header (GMIME_OBJECT (reply),\r
+-                                "References", references);\r
+-    }\r
++    if (!orig_references)\r
++      /* Treat errors like missing References headers. */\r
++      orig_references = "";\r
++    references = talloc_asprintf (ctx, "%s%s%s",\r
++                                *orig_references ? orig_references : "",\r
++                                *orig_references ? " " : "",\r
++                                in_reply_to);\r
++    g_mime_object_set_header (GMIME_OBJECT (reply),\r
++                            "References", references);\r
\r
+     return reply;\r
+ }\r
+\r
+\r