From 87cfd2aef18f721c3469fc2b20c4582b9ebcf710 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Wed, 16 Oct 2013 22:00:10 +0300 Subject: [PATCH] [PATCH 3/6] cli: make the hacky from guessing more liberal --- 03/5a2352a27964769248e03d73b8308397689b95 | 101 ++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 03/5a2352a27964769248e03d73b8308397689b95 diff --git a/03/5a2352a27964769248e03d73b8308397689b95 b/03/5a2352a27964769248e03d73b8308397689b95 new file mode 100644 index 000000000..4ac4bdd19 --- /dev/null +++ b/03/5a2352a27964769248e03d73b8308397689b95 @@ -0,0 +1,101 @@ +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 C103C431FBC + for ; Wed, 16 Oct 2013 12:00:31 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" +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 Aia0+NjQfwpL for ; + Wed, 16 Oct 2013 12:00:27 -0700 (PDT) +Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com + [74.125.83.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 059EB431FB6 for ; Wed, 16 Oct 2013 12:00:25 -0700 + (PDT) +Received: by mail-ee0-f47.google.com with SMTP id d49so580083eek.6 + for ; Wed, 16 Oct 2013 12:00:24 -0700 (PDT) +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=mJ/sNzkxRyvvK7xDQmKkzIs57yiqR2k77GY/rkLdWB0=; + b=ar1UTaMhyr9vmJpIlKlXVS+vKfCcRoa2hj1YVW9lHLew7xgRwio0Ri1k81qm78McQ6 + lq1yEXM/Jj8iSdSEn4qkO48FXNImXRVz31INKr8H/idp95nBpHwlOmFh0sXqtUAHn3MS + UYfDX94nFDf5ms2SCZsvBcO/pW/FSJx2St0hwaAkZDehQknyrVf1lF0zpN/Thn6e16WW + TMAavgnAKeHb/VdRptvYpW4zo8jg4aKdSbwId9yd7Y5juM1idTEbE+PQqsXsmJDP01ic + 6SoheCUmC/SI6YY2aR9OeWzP8VkFbhav/ElFNXsa/nO2K/MhOkWijg1BoveuKCrk+qOZ + TtyQ== +X-Gm-Message-State: + ALoCoQmd8zSnQSGD1n87iW/iIRroLZjsmXebFpiQ4RuCluEg3xLOZx99XY+9vVegS44QjfvLZAmg +X-Received: by 10.14.42.6 with SMTP id i6mr5709773eeb.65.1381950024909; + Wed, 16 Oct 2013 12:00:24 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + x47sm183065259eea.16.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 16 Oct 2013 12:00:24 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 3/6] cli: make the hacky from guessing more liberal +Date: Wed, 16 Oct 2013 22:00:10 +0300 +Message-Id: + <7dd03cd9c1677be8c5937d11b376d4cbd26c64f5.1381948853.git.jani@nikula.org> +X-Mailer: git-send-email 1.8.4.rc3 +In-Reply-To: +References: +In-Reply-To: +References: +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: Wed, 16 Oct 2013 19:00:32 -0000 + +This is in preparation of switching to gmime header parsing. Accept +"for" and "by" preceded by tabs in the received header. This is a bit +flaky, but so is the whole guessing code. +--- + notmuch-reply.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/notmuch-reply.c b/notmuch-reply.c +index 9d6f843..4b67e66 100644 +--- a/notmuch-reply.c ++++ b/notmuch-reply.c +@@ -423,7 +423,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message + /* First we look for a " for " in the received + * header + */ +- ptr = strstr (received, " for "); ++ ptr = strstr (received, "for "); + + /* Note: ptr potentially contains a list of email addresses. */ + addr = user_address_in_string (ptr, config); +@@ -440,7 +440,7 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message + * system in this step of the receive chain + */ + by = received; +- while((by = strstr (by, " by ")) != NULL) { ++ while((by = strstr (by, "by ")) != NULL) { + by += 4; + if (*by == '\0') + break; +-- +1.8.4.rc3 + -- 2.26.2