[PATCH 3/6] cli: make the hacky from guessing more liberal

Jani Nikula jani at nikula.org
Thu Oct 17 07:03:14 PDT 2013


On Thu, 17 Oct 2013, Moritz Wilhelmy <mw+notmuch at barfooze.de> wrote:
> Hello,
>
> On Wed, Oct 16, 2013 at 22:00:10 +0300, 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.
>> ---
>>  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 <email at add.res>" 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;
>
> FWIW, I didn't read the rest of the code, but shouldn't the last line
> be changed to "by += 3" when you're dropping a space from the strstr?

Absolutely, same in the "for" case. Thanks.

Jani.


>
>
> Best,
>
> Moritz
> _______________________________________________
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list