From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 09CD56DE092A for ; Sat, 18 Jun 2016 14:33:25 -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.505 X-Spam-Level: X-Spam-Status: No, score=0.505 tagged_above=-999 required=5 tests=[AWL=1.225, 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 8HV_uJGfYNBP for ; Sat, 18 Jun 2016 14:33:17 -0700 (PDT) Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by arlo.cworth.org (Postfix) with ESMTPS id 3D6BE6DE028C for ; Sat, 18 Jun 2016 14:33:05 -0700 (PDT) Received: by mail-wm0-f68.google.com with SMTP id r201so5510009wme.0 for ; Sat, 18 Jun 2016 14:33:05 -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=fbeShvw4M66SrxkIEgtBhkFxVPPUGacbY8QcRCVt1P8=; b=TuT63OI69vQWCgyoYinWpBLsWhLPf89uKOBeP0/497r7W/8SGwkpezKJZg+o6d09tY o1x1JFB3UcEsLRt5KEYTqLyY/ozgffjSTldK5Xw9XMvKs+IB8saI/PTeMO+XlO3cjq1B WAwVRudJp4A1lTM6eJUSff62hhfY/Rl1mZGA3ki3fqUzLmiZrWrbCo5k/e5QkUT8BKLY IMylLqjzM/+O0QDhjfimP1LYdWdl5bzwQcZ7a2GWFZF9S2KcTv3uzxm8QvtmsOt/6Phm hiZpIAJRgMWhA0AS8wwSE9r+F9m1a2iOenEU9FSe2QugWOB8AzbmRgUYndJ0Lc0n+LR9 +kSA== 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=fbeShvw4M66SrxkIEgtBhkFxVPPUGacbY8QcRCVt1P8=; b=eXJX2QJbSYdentWTtakc5lE3Z98ONp95alzqJ3MoP5s4zxUfpDbnkTJETe5E5H6B75 ZHddAbBE7izwLiDXlwcnP/X6dSf1z5pT2Yweqo+788Bu5Vrx6GbomS4ea4I9SeAJtNYG 4x4PTOFx/wjJZxEAcHZPqMB2O+zXKO6l+Tyt8/NEvGzNJE5Vtl70s69l5CXy6eHqF7bO NGHTxinpnmeKfuKzFNipWPkPCC2+uEasCTMPdGVaQigx9gVluT/WEzzggyC3EwmmGmaq kpxcbIc4DPodITRqPSO0yLLlHvBs4rbkwNwBtbGTIreRyO4bl9fYs110uYTSJHQGuaqn EAhg== X-Gm-Message-State: ALyK8tLGDtwiFEGvyotgCsNzh+OIOxRZkfCBcC0/IgGlH/RrRWHe3qg68rE61sYrsZZ7hA== X-Received: by 10.28.26.4 with SMTP id a4mr4124855wma.92.1466285583959; Sat, 18 Jun 2016 14:33:03 -0700 (PDT) Received: from localhost (dsl-hkibrasgw2-58c37a-44.dhcp.inet.fi. [88.195.122.44]) by smtp.gmail.com with ESMTPSA id r130sm1676834wmf.20.2016.06.18.14.33.03 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 18 Jun 2016 14:33:03 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Cc: jani@nikula.org, Daniel Kahn Gillmor Subject: [PATCH 4/7] cli/reply: reorganize create_reply_message() Date: Sun, 19 Jun 2016 00:31:30 +0300 Message-Id: <50d4410b1d865fbf1618febfae2f54c5173243ae.1466284726.git.jani@nikula.org> 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: Sat, 18 Jun 2016 21:33:25 -0000 Again, in preparation for later unification, reorganize create_reply_message() to be more similar to the open coded version in the headers-only format reply code. Due to "pretty" header ordering, there should be no change in output. There should be no functional changes. --- notmuch-reply.c | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/notmuch-reply.c b/notmuch-reply.c index 4b97ffa4f096..eb07405591fd 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -532,12 +532,20 @@ create_reply_message(void *ctx, return NULL; } - subject = notmuch_message_get_header (message, "subject"); - if (subject) { - if (strncasecmp (subject, "Re:", 3)) - subject = talloc_asprintf (ctx, "Re: %s", subject); - g_mime_message_set_subject (reply, subject); - } + in_reply_to = talloc_asprintf (ctx, "<%s>", + notmuch_message_get_message_id (message)); + + g_mime_object_set_header (GMIME_OBJECT (reply), "In-Reply-To", in_reply_to); + + orig_references = notmuch_message_get_header (message, "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); from_addr = add_recipients_from_message (reply, config, message, reply_all); @@ -572,25 +580,14 @@ create_reply_message(void *ctx, from_addr = talloc_asprintf (ctx, "%s <%s>", notmuch_config_get_user_name (config), from_addr); - g_mime_object_set_header (GMIME_OBJECT (reply), - "From", from_addr); - - in_reply_to = talloc_asprintf (ctx, "<%s>", - notmuch_message_get_message_id (message)); - - g_mime_object_set_header (GMIME_OBJECT (reply), - "In-Reply-To", in_reply_to); + g_mime_object_set_header (GMIME_OBJECT (reply), "From", from_addr); - orig_references = notmuch_message_get_header (message, "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); + subject = notmuch_message_get_header (message, "subject"); + if (subject) { + if (strncasecmp (subject, "Re:", 3)) + subject = talloc_asprintf (ctx, "Re: %s", subject); + g_mime_message_set_subject (reply, subject); + } return reply; } -- 2.1.4