From: Jani Nikula Date: Thu, 17 Oct 2013 11:52:27 +0000 (+0300) Subject: Re: [PATCH 3/6] cli: make the hacky from guessing more liberal X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f4dfa14c96ea55e3a56bf16dbe8fd40282406771;p=notmuch-archives.git Re: [PATCH 3/6] cli: make the hacky from guessing more liberal --- diff --git a/78/b66aea2332ace29e39f7758490c351976f7f8f b/78/b66aea2332ace29e39f7758490c351976f7f8f new file mode 100644 index 000000000..d8aa26513 --- /dev/null +++ b/78/b66aea2332ace29e39f7758490c351976f7f8f @@ -0,0 +1,135 @@ +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 461E3431FB6 + for ; Thu, 17 Oct 2013 04:52:35 -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 2WJ6VVcCFY93 for ; + Thu, 17 Oct 2013 04:52:30 -0700 (PDT) +Received: from mail-ea0-f181.google.com (mail-ea0-f181.google.com + [209.85.215.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B3B49431FAE + for ; Thu, 17 Oct 2013 04:52:30 -0700 (PDT) +Received: by mail-ea0-f181.google.com with SMTP id d10so996859eaj.40 + for ; Thu, 17 Oct 2013 04:52:29 -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:subject:in-reply-to:references + :user-agent:date:message-id:mime-version:content-type; + bh=ki+FtPgghhmEVOAl/RQiUm/GfuxZb+WzLbzfoZhF2xc=; + b=TIkXH3HkXJK+krQHDFFzyJ3fOHyXE5UFJOHZaIN/wegl5/kMeGYwtXNQEs4+Cv87cp + wQuoj9n6Y7gmIttPDbkq8G2M888KBvH5oGuC+aWGKYgrtUfVSS1t8QdS/5auuEbCsEX8 + Zu4MQm1vW5yQxqbnFT69pyCKNY4M0aLtX79o5Ha1yyqOqKy2Lji2Fkb+jKg47wgcuXOP + CGB2MJRenYNmXCWFk6CiS1lRgbvQOZqeJHIA42s7c2S+5BJndyJBUJPebSjD9YhA8WHx + W7+hi6jot5z2Ppw1kJnN5FuArYFEN02ODwPs9VyuXcgFGKUJdHqukOqP+ppEQw2pAhDh + yWzw== +X-Gm-Message-State: + ALoCoQnuc1O/OMfxQtHPde5oPstPfTLXguRKyxjfnyDBGcwiXZUtCvDB8EYLgmpsSxsDjPszCKmK +X-Received: by 10.14.183.130 with SMTP id q2mr3625742eem.64.1382010749510; + Thu, 17 Oct 2013 04:52:29 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + x47sm192119360eea.16.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Thu, 17 Oct 2013 04:52:28 -0700 (PDT) +From: Jani Nikula +To: Mark Walters , notmuch@notmuchmail.org +Subject: Re: [PATCH 3/6] cli: make the hacky from guessing more liberal +In-Reply-To: <87li1sb9l8.fsf@qmul.ac.uk> +References: + <7dd03cd9c1677be8c5937d11b376d4cbd26c64f5.1381948853.git.jani@nikula.org> + <87li1sb9l8.fsf@qmul.ac.uk> +User-Agent: Notmuch/0.16+97~g6878b0b (http://notmuchmail.org) Emacs/24.3.1 + (x86_64-pc-linux-gnu) +Date: Thu, 17 Oct 2013 14:52:27 +0300 +Message-ID: <87hacgqflw.fsf@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain +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: Thu, 17 Oct 2013 11:52:35 -0000 + +On Thu, 17 Oct 2013, Mark Walters wrote: +> On Wed, 16 Oct 2013, Jani Nikula wrote: +>> 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. +> +> I am happy with the change but I think a little more explanation of the +> problem it fixes would be helpful. Is it that there could be a \n \t +> before the "for"/"by" or something else? + +It's the same header folding by tabs here too. In your mail that I'm +replying to, the received headers are folded with tabs. (This may be due +to mailman doing bad things, but that's irrelevant.) There may be a tab +preceding the "for"/"by" instead of a space. Obviously this could be +made more robust, but if you look at what the from guessing does, you +realize it's quite hacky anyway, and a last resort. So I didn't bother, +at least not for now, for this series. Minimal change to make tests +pass. + +>> --- +>> 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 "); +> +> The comment should be updated to match the code (and depending on the +> answer to the above maybe explain that too) + +Agreed. + +BR, +Jani. + +> +> Best wishes +> +> Mark +>> +>> /* 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 +>> +>> _______________________________________________ +>> notmuch mailing list +>> notmuch@notmuchmail.org +>> http://notmuchmail.org/mailman/listinfo/notmuch