From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id C57FB429E32 for ; Sat, 30 Nov 2013 07:34:20 -0800 (PST) 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 mnPx0zkDrq1r for ; Sat, 30 Nov 2013 07:34:16 -0800 (PST) Received: from mail-ea0-f170.google.com (mail-ea0-f170.google.com [209.85.215.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id CB6C4431FAF for ; Sat, 30 Nov 2013 07:34:10 -0800 (PST) Received: by mail-ea0-f170.google.com with SMTP id k10so7669523eaj.15 for ; Sat, 30 Nov 2013 07:34:09 -0800 (PST) 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=RNKsLiEBOBVvW/FxB7Xzhr3InvqwtkWWlgENy/Ffikk=; b=a4RZEedWI3TTf2Joo2PxQjH2IoyV6RXO54jSfW3FUzbMyYuKCRTKmA0vh8D9ggfUGl XZZZLU5mugza5D/eTS15SG+JeXpBuOYqkxE1QqiIEZBW00nlqZN+DurX5Qac1j6d4/dL H9e5cRr49GeZuh11TrskFZNiTw3Z57FldiJCkPyNgQYoEiF1KEbkmFz5RSSxo0FhUhmm nCQQ62ir8WvIubwmbVTYlPdu/9l5Smx9xx3RFdyc2EXFAFCP6gQxcSyapaagngoJazNd 6QCkLMkCtKBCsBuwEP6ZBiZwGxVndGE8AHOWrRD522AeVXzHgbjwSzYn6jjduFoAEQ6B iSJw== X-Gm-Message-State: ALoCoQkp9lK89mdR14nnpjgZq2Q6iKZCQ9/OY+Bh70KS3wvJNtThtJ8WZVlSrtzRGu9NNNkCZtTZ X-Received: by 10.14.22.68 with SMTP id s44mr57829545ees.16.1385825649736; Sat, 30 Nov 2013 07:34:09 -0800 (PST) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id g7sm3264411eet.12.2013.11.30.07.34.08 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 30 Nov 2013 07:34:09 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v2 4/7] cli: sanitize the received header before scanning for replies Date: Sat, 30 Nov 2013 17:33:53 +0200 Message-Id: <90e472ab54b58786c2462ae3656aafdc27d10ca5.1385825425.git.jani@nikula.org> X-Mailer: git-send-email 1.8.4.2 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: Sat, 30 Nov 2013 15:34:21 -0000 This makes the from guessing agnostic to header folding by spaces or tabs. --- notmuch-reply.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/notmuch-reply.c b/notmuch-reply.c index ca41405..a2eee17 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -21,6 +21,7 @@ */ #include "notmuch-client.h" +#include "string-util.h" #include "sprinter.h" static void @@ -463,14 +464,21 @@ guess_from_received_header (notmuch_config_t *config, notmuch_message_t *message) { const char *received, *addr; + char *sanitized; received = notmuch_message_get_header (message, "received"); if (! received) return NULL; - addr = guess_from_received_for (config, received); + sanitized = sanitize_string (config, received); + if (! sanitized) + return NULL; + + addr = guess_from_received_for (config, sanitized); if (! addr) - addr = guess_from_received_by (config, received); + addr = guess_from_received_by (config, sanitized); + + talloc_free (sanitized); return addr; } -- 1.8.4.2