From: Jani Nikula Date: Sat, 13 Aug 2016 11:37:38 +0000 (+0300) Subject: [PATCH v2 14/14] cli/reply: only pass gmime message to add recipients to reply message X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=136e941fd2e0acee28717e9f8be4412c6c5b2c5f;p=notmuch-archives.git [PATCH v2 14/14] cli/reply: only pass gmime message to add recipients to reply message --- diff --git a/09/983ee4cd16bd4951c3741fde7be541e9d4125f b/09/983ee4cd16bd4951c3741fde7be541e9d4125f new file mode 100644 index 000000000..dcc60f432 --- /dev/null +++ b/09/983ee4cd16bd4951c3741fde7be541e9d4125f @@ -0,0 +1,187 @@ +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 47DF56DE3BB8 + for ; Sat, 13 Aug 2016 04:42:06 -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.258 +X-Spam-Level: +X-Spam-Status: No, score=0.258 tagged_above=-999 required=5 tests=[AWL=0.978, + 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 aX6zWSfjp15I for ; + Sat, 13 Aug 2016 04:41:58 -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 0270D6DE38CC for + ; Sat, 13 Aug 2016 04:39:29 -0700 (PDT) +Received: by mail-wm0-f68.google.com with SMTP id i138so2005161wmf.3 + for ; Sat, 13 Aug 2016 04:39:28 -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=Np7vZjo3xd1CpTP3mQA7HMJMgv9MDtF/KyMHr1zBrOKpIr3bpU3g5qM/QSfTPAtsmY + ZG8PJblGgpb0a7eC9r/2yMdF74rWWGwq/iFq7TOzkGWqbNvG1LmdrQDEVoGtHsa1ddvv + b2KR5nhcFtDU7ZwAxWOzvWw779DCVAdWGXkIvOMgDkidTFo5rJ2IEg06faG11y9p8ACv + fK52BLpRRZCz3zh7bjNRUqiD3+x9403nZgxdE4v+jTGA/w4BtzW3vuUHEmLcrY7aY/36 + 2u6diSHbho6ZhubeT8dts6GK2jD1Q7HsbBlR213faUCi8OHbUUFXex1VMdqAqfA/KF5c + zgiw== +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=VaPELLptwrBe8xi37WDKP5TRj5VuqQR9DnHNqOt4v2OUN47qLCxolvwZIbtmlp3W7e + LI+oYJOXKn844z7va3tncyLq1gCxjCIF51LxRnAGZ8D/YmrVHSXSucmEgEg04ZolsSUw + mtgVSmV443IcFHeKWFyzCnTo9JXUL0Yc4RiJ+fhAIDQMOEnVCQFXvzZXz4tgeofLbTMv + T4yC0jjx2M/Urh+vJ7iAvveYwkkbthKpXhAiRjF9ItS9wjcBmtDIyvLQPdHvR6PWyR8q + BvIT4qVv8zryksxxldsct+5RXTFTmElz2HMJnnrnf9zxWisqx0026Lf9cbl/IR4wgXNg + 8U8g== +X-Gm-Message-State: + AEkoousjDToWABSkL+vq3RVgIufxEefVyBqmvAV/Xn0AflD9OwSZElTxsk1ldCWCEdI2VQ== +X-Received: by 10.195.11.104 with SMTP id eh8mr19963139wjd.128.1471088363229; + Sat, 13 Aug 2016 04:39:23 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c368-70.dhcp.inet.fi. + [88.195.104.70]) + by smtp.gmail.com with ESMTPSA id q23sm6814829wme.17.2016.08.13.04.39.22 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 13 Aug 2016 04:39:22 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Cc: Daniel Kahn Gillmor , + jani@nikula.org +Subject: [PATCH v2 14/14] cli/reply: only pass gmime message to add recipients + to reply message +Date: Sat, 13 Aug 2016 14:37:38 +0300 +Message-Id: + <2ddcc0d192bf6a9c6296417bc4d7f9ce6b1d27bc.1471088022.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, 13 Aug 2016 11:42:06 -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 +