From: Jani Nikula Date: Sat, 13 Aug 2016 11:37:36 +0000 (+0300) Subject: [PATCH v2 12/14] cli/reply: pass internet address list to munge detect X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b10eea0d3fd06a940d4cdce63a94b05c810a7e88;p=notmuch-archives.git [PATCH v2 12/14] cli/reply: pass internet address list to munge detect --- diff --git a/77/6106a56f5b713f1c6dfacdb9aaf148b2600b67 b/77/6106a56f5b713f1c6dfacdb9aaf148b2600b67 new file mode 100644 index 000000000..8158897dd --- /dev/null +++ b/77/6106a56f5b713f1c6dfacdb9aaf148b2600b67 @@ -0,0 +1,141 @@ +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 5EE336DE3948 + for ; Sat, 13 Aug 2016 04:41:27 -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.261 +X-Spam-Level: +X-Spam-Status: No, score=0.261 tagged_above=-999 required=5 tests=[AWL=0.981, + 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 Uh3o7gtWwd6T for ; + Sat, 13 Aug 2016 04:41:19 -0700 (PDT) +Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com + [74.125.82.66]) by arlo.cworth.org (Postfix) with ESMTPS id 88BF26DE38C3 for + ; Sat, 13 Aug 2016 04:39:21 -0700 (PDT) +Received: by mail-wm0-f66.google.com with SMTP id i138so2004722wmf.3 + for ; Sat, 13 Aug 2016 04:39:21 -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=FgEWcwZwZNHGDLoYAMew8rAbVt2GXziMhF5ZA3VKnBg=; + b=yxyVfzifAIjSe86Va0b+vOpw4OF4cY+tI+gB+Z6wGFAP+Q6j8oFqNHLK20fH6iG5rY + L6nZVvnSlNtd+D+nfPfkOn23r84yZUFI5N0icQ7SS8FYKCS/0m7RKhC5b9vdCorXVwIr + eCcJKN13HI8h7zXTeQPhWBjCTd9HtEEtmcQHeYE8Da71wowbcv9nSGYDTSgLOJPPYHcs + fnlCW29CzKmXhqpW/tSbmgZz5m3jlifOHHwKGLRg3ON2ZRxqBxpEovUiR/5jH55BOhUi + IuoCygv5h6a3mWgCW662Gif+sHc8x2K6P6zETzKv022TR7ZH3n+KgJnIaYzv08R/u/TG + IF7Q== +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=FgEWcwZwZNHGDLoYAMew8rAbVt2GXziMhF5ZA3VKnBg=; + b=ZZbk6isgkyl5mgkEsivzj+5d5A1Wib6XL/AWDmLfE05Z2wTnsy8aWI/oMARHOPQMO/ + 4a5JFmsMipnsvtr6NCkFyye06ueHz6y2980YSAlqLA6cRPX99foGo2f10jCW1hLlfVJe + T6Qwt5dRwbiH2dMEC+cHiKwky6T7cpRtqVKfr2nit6Xf/cPmX2ytjIWDFedYbAne98mv + g2XSGWrv9eVBSXaXt0YCfbR1cWWXKPpFBpX1zhRucYOzPKyapyS7ig+gQUkxSlKU77zY + jB7xdiponE1KULsLSZLCMi1WYwkKYs1a65+ojzOOkhbBNN2V8KSlh5pmeSzMpqaPZU2N + E02A== +X-Gm-Message-State: + AEkoousLcqwQxAqKNS6kdqXJanpkx88CrEXZcTk1HBfdbIna+cAhRcuJJYCTNualKeSX8w== +X-Received: by 10.28.38.196 with SMTP id m187mr3227141wmm.81.1471088360208; + Sat, 13 Aug 2016 04:39:20 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c368-70.dhcp.inet.fi. + [88.195.104.70]) + by smtp.gmail.com with ESMTPSA id d64sm6799981wmc.22.2016.08.13.04.39.19 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sat, 13 Aug 2016 04:39:19 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Cc: Daniel Kahn Gillmor , + jani@nikula.org +Subject: [PATCH v2 12/14] cli/reply: pass internet address list to munge + detect +Date: Sat, 13 Aug 2016 14:37:36 +0300 +Message-Id: + <2bdf4c7e53829fed525671f9f8f874323737f814.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:41:27 -0000 + +--- + notmuch-reply.c | 20 ++++++++++++-------- + 1 file changed, 12 insertions(+), 8 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index 98034485c546..cf4248bd6794 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -231,19 +231,18 @@ scan_address_list (InternetAddressList *list, + * in either the 'To' or 'Cc' header of the message? + */ + static int +-reply_to_header_is_redundant (notmuch_message_t *message, const char *reply_to) ++reply_to_header_is_redundant (notmuch_message_t *message, ++ InternetAddressList *reply_to_list) + { + const char *to, *cc, *addr; +- InternetAddressList *list; + InternetAddress *address; + InternetAddressMailbox *mailbox; + +- list = internet_address_list_parse_string (reply_to); +- +- if (internet_address_list_length (list) != 1) ++ if (reply_to_list == NULL || ++ internet_address_list_length (reply_to_list) != 1) + return 0; + +- address = internet_address_list_get_address (list, 0); ++ address = internet_address_list_get_address (reply_to_list, 0); + if (INTERNET_ADDRESS_IS_GROUP (address)) + return 0; + +@@ -269,6 +268,8 @@ static InternetAddressList *get_sender(notmuch_message_t *message, + + reply_to = g_mime_message_get_reply_to (mime_message); + if (reply_to && *reply_to) { ++ InternetAddressList *reply_to_list; ++ + /* + * Some mailing lists munge the Reply-To header despite it + * being A Bad Thing, see +@@ -282,8 +283,11 @@ static InternetAddressList *get_sender(notmuch_message_t *message, + * to the list. Note that the address in the Reply-To header + * will always appear in the reply if reply_all is true. + */ +- if (! reply_to_header_is_redundant (message, reply_to)) +- return internet_address_list_parse_string (reply_to); ++ reply_to_list = internet_address_list_parse_string (reply_to); ++ 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 ( +-- +2.1.4 +