[PATCH 2/9] lib: private string map (associative array) API
[notmuch-archives.git] / 2f / bc4f504a95053907711c3c5ba2e79f8bb4ef4c
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id C57FB429E32\r
6         for <notmuch@notmuchmail.org>; Sat, 30 Nov 2013 07:34:20 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: -0.7\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
13         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id mnPx0zkDrq1r for <notmuch@notmuchmail.org>;\r
17         Sat, 30 Nov 2013 07:34:16 -0800 (PST)\r
18 Received: from mail-ea0-f170.google.com (mail-ea0-f170.google.com\r
19         [209.85.215.170]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id CB6C4431FAF\r
22         for <notmuch@notmuchmail.org>; Sat, 30 Nov 2013 07:34:10 -0800 (PST)\r
23 Received: by mail-ea0-f170.google.com with SMTP id k10so7669523eaj.15\r
24         for <notmuch@notmuchmail.org>; Sat, 30 Nov 2013 07:34:09 -0800 (PST)\r
25 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=1e100.net; s=20130820;\r
27         h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
28         :references:in-reply-to:references;\r
29         bh=RNKsLiEBOBVvW/FxB7Xzhr3InvqwtkWWlgENy/Ffikk=;\r
30         b=a4RZEedWI3TTf2Joo2PxQjH2IoyV6RXO54jSfW3FUzbMyYuKCRTKmA0vh8D9ggfUGl\r
31         XZZZLU5mugza5D/eTS15SG+JeXpBuOYqkxE1QqiIEZBW00nlqZN+DurX5Qac1j6d4/dL\r
32         H9e5cRr49GeZuh11TrskFZNiTw3Z57FldiJCkPyNgQYoEiF1KEbkmFz5RSSxo0FhUhmm\r
33         nCQQ62ir8WvIubwmbVTYlPdu/9l5Smx9xx3RFdyc2EXFAFCP6gQxcSyapaagngoJazNd\r
34         6QCkLMkCtKBCsBuwEP6ZBiZwGxVndGE8AHOWrRD522AeVXzHgbjwSzYn6jjduFoAEQ6B\r
35         iSJw==\r
36 X-Gm-Message-State:\r
37  ALoCoQkp9lK89mdR14nnpjgZq2Q6iKZCQ9/OY+Bh70KS3wvJNtThtJ8WZVlSrtzRGu9NNNkCZtTZ\r
38 X-Received: by 10.14.22.68 with SMTP id s44mr57829545ees.16.1385825649736;\r
39         Sat, 30 Nov 2013 07:34:09 -0800 (PST)\r
40 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
41         [88.195.111.91])\r
42         by mx.google.com with ESMTPSA id g7sm3264411eet.12.2013.11.30.07.34.08\r
43         for <multiple recipients>\r
44         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
45         Sat, 30 Nov 2013 07:34:09 -0800 (PST)\r
46 From: Jani Nikula <jani@nikula.org>\r
47 To: notmuch@notmuchmail.org\r
48 Subject: [PATCH v2 4/7] cli: sanitize the received header before scanning for\r
49         replies\r
50 Date: Sat, 30 Nov 2013 17:33:53 +0200\r
51 Message-Id:\r
52  <90e472ab54b58786c2462ae3656aafdc27d10ca5.1385825425.git.jani@nikula.org>\r
53 X-Mailer: git-send-email 1.8.4.2\r
54 In-Reply-To: <cover.1385825425.git.jani@nikula.org>\r
55 References: <cover.1385825425.git.jani@nikula.org>\r
56 In-Reply-To: <cover.1385825425.git.jani@nikula.org>\r
57 References: <cover.1385825425.git.jani@nikula.org>\r
58 X-BeenThere: notmuch@notmuchmail.org\r
59 X-Mailman-Version: 2.1.13\r
60 Precedence: list\r
61 List-Id: "Use and development of the notmuch mail system."\r
62         <notmuch.notmuchmail.org>\r
63 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
64         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
65 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
66 List-Post: <mailto:notmuch@notmuchmail.org>\r
67 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
68 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
69         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
70 X-List-Received-Date: Sat, 30 Nov 2013 15:34:21 -0000\r
71 \r
72 This makes the from guessing agnostic to header folding by spaces or\r
73 tabs.\r
74 ---\r
75  notmuch-reply.c | 12 ++++++++++--\r
76  1 file changed, 10 insertions(+), 2 deletions(-)\r
77 \r
78 diff --git a/notmuch-reply.c b/notmuch-reply.c\r
79 index ca41405..a2eee17 100644\r
80 --- a/notmuch-reply.c\r
81 +++ b/notmuch-reply.c\r
82 @@ -21,6 +21,7 @@\r
83   */\r
84  \r
85  #include "notmuch-client.h"\r
86 +#include "string-util.h"\r
87  #include "sprinter.h"\r
88  \r
89  static void\r
90 @@ -463,14 +464,21 @@ guess_from_received_header (notmuch_config_t *config,\r
91                             notmuch_message_t *message)\r
92  {\r
93      const char *received, *addr;\r
94 +    char *sanitized;\r
95  \r
96      received = notmuch_message_get_header (message, "received");\r
97      if (! received)\r
98         return NULL;\r
99  \r
100 -    addr = guess_from_received_for (config, received);\r
101 +    sanitized = sanitize_string (config, received);\r
102 +    if (! sanitized)\r
103 +       return NULL;\r
104 +\r
105 +    addr = guess_from_received_for (config, sanitized);\r
106      if (! addr)\r
107 -       addr = guess_from_received_by (config, received);\r
108 +       addr = guess_from_received_by (config, sanitized);\r
109 +\r
110 +    talloc_free (sanitized);\r
111  \r
112      return addr;\r
113  }\r
114 -- \r
115 1.8.4.2\r
116 \r