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