Re: Linking a privately built -lxapian
[notmuch-archives.git] / 26 / 34ac6df63197233bc4112d766187244f592c51
1 Return-Path: <amdragon@mit.edu>\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 AB655431FBF\r
6         for <notmuch@notmuchmail.org>; Sat,  8 Sep 2012 10:25:21 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id L9PdA4g8-Lll for <notmuch@notmuchmail.org>;\r
16         Sat,  8 Sep 2012 10:25:19 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
18         [18.9.25.14])\r
19         by olra.theworths.org (Postfix) with ESMTP id 61D6F431FC0\r
20         for <notmuch@notmuchmail.org>; Sat,  8 Sep 2012 10:25:16 -0700 (PDT)\r
21 X-AuditID: 1209190e-b7f256d000000c6a-61-504b7f7bc471\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id F6.78.03178.B7F7B405; Sat,  8 Sep 2012 13:25:16 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q88HPFQL014468; \r
27         Sat, 8 Sep 2012 13:25:15 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q88HPE9w026436\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sat, 8 Sep 2012 13:25:15 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1TAOmQ-00061x-9K; Sat, 08 Sep 2012 13:25:14 -0400\r
37 Date: Sat, 8 Sep 2012 13:25:14 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Jameson Graef Rollins <jrollins@finestructure.net>\r
40 Subject: Re: [PATCH 03/11] lib: give _thread_cleanup_author a more generic\r
41  name\r
42 Message-ID: <20120908172514.GA22336@mit.edu>\r
43 References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net>\r
44         <1345427570-26518-2-git-send-email-jrollins@finestructure.net>\r
45         <1345427570-26518-3-git-send-email-jrollins@finestructure.net>\r
46         <1345427570-26518-4-git-send-email-jrollins@finestructure.net>\r
47 MIME-Version: 1.0\r
48 Content-Type: text/plain; charset=us-ascii\r
49 Content-Disposition: inline\r
50 In-Reply-To: <1345427570-26518-4-git-send-email-jrollins@finestructure.net>\r
51 User-Agent: Mutt/1.5.21 (2010-09-15)\r
52 X-Brightmail-Tracker:\r
53  H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsUixG6noltT7x1gcDfRYs8+L4vrN2cyOzB5\r
54         3D3N5fFs1S3mAKYoLpuU1JzMstQifbsErox1R+4zF7TIVDxYv42tgbFbtIuRk0NCwESic9tJ\r
55         ZghbTOLCvfVsILaQwD5Gif3zuboYuYDs9YwSU+/uYIZwTjBJ3HncyQxRtYRR4nZnbhcjBweL\r
56         gIrE6bUeIGE2AQ2JbfuXM4LYIgJmEj1f/oDZzAJaEls3fgCzhQUCJXrvLWcBsXkFdCTuf5jC\r
57         AjGyl0liyc16iLigxMmZT1hgem/8e8kEsopZQFpi+T8OkDCngLfEpO/tYDeLAl0w5eQ2tgmM\r
58         QrOQdM9C0j0LoXsBI/MqRtmU3Crd3MTMnOLUZN3i5MS8vNQiXWO93MwSvdSU0k2MoGDmlOTb\r
59         wfj1oNIhRgEORiUe3g1yXgFCrIllxZW5hxglOZiURHl313gHCPEl5adUZiQWZ8QXleakFh9i\r
60         lOBgVhLhvZ4OlONNSaysSi3Kh0lJc7AoifNeSbnpLySQnliSmp2aWpBaBJOV4eBQkuC1rQNq\r
61         FCxKTU+tSMvMKUFIM3FwggznARpeAFLDW1yQmFucmQ6RP8WoKCXO6w1ykQBIIqM0D64Xlmxe\r
62         MYoDvSIMsYIHmKjgul8BDWYCGizyzANkcEkiQkqqgZF175zCF0wHao67SJT1BrzoPnidn0vw\r
63         4Z9a8aP8kbfatm/w4J8icN70xUtdsd8zviV1SywSWyeXnDv92IoKkzPr58cycvJGN+ZUzaxy\r
64         Ftc5N0V9zQT/ALXI7aHmLv++n6nvylaWD/u8TlLuV9dRXROhyqWqy26fXfT1rrDAD7aehOV7\r
65         Vy2SuqrEUpyRaKjFXFScCABn4DXFEQMAAA==\r
66 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Sat, 08 Sep 2012 17:25:22 -0000\r
80 \r
81 Should this patch also rename calls to this function?\r
82 \r
83 Quoth Jameson Graef Rollins on Aug 19 at  6:52 pm:\r
84 > We will use this for cleaning non-author address fields, so we give it\r
85 > the more generic name _thread_cleanup_address.\r
86 > ---\r
87 >  lib/thread.cc |   43 ++++++++++++++++++++++---------------------\r
88 >  1 file changed, 22 insertions(+), 21 deletions(-)\r
89\r
90 > diff --git a/lib/thread.cc b/lib/thread.cc\r
91 > index 9e0e5cb..b53ccb0 100644\r
92 > --- a/lib/thread.cc\r
93 > +++ b/lib/thread.cc\r
94 > @@ -242,48 +242,49 @@ _resolve_thread_authors_string (notmuch_thread_t *thread)\r
95 >   * "Last, First MI" <first.mi.last@company.com>\r
96 >   */\r
97 >  static char *\r
98 > -_thread_cleanup_author (notmuch_thread_t *thread,\r
99 > -                     const char *author, const char *from)\r
100 > +_thread_cleanup_address (notmuch_thread_t *thread,\r
101 > +                      const char *address,\r
102 > +                      const char *original)\r
103 >  {\r
104 > -    char *clean_author,*test_author;\r
105 > +    char *clean_address,*test_address;\r
106 >      const char *comma;\r
107 >      char *blank;\r
108 >      int fname,lname;\r
109 >  \r
110 > -    if (author == NULL)\r
111 > +    if (address == NULL)\r
112 >       return NULL;\r
113 > -    clean_author = talloc_strdup(thread, author);\r
114 > -    if (clean_author == NULL)\r
115 > +    clean_address = talloc_strdup(thread, address);\r
116 > +    if (clean_address == NULL)\r
117 >       return NULL;\r
118 >      /* check if there's a comma in the name and that there's a\r
119 >       * component of the name behind it (so the name doesn't end with\r
120 >       * the comma - in which case the string that strchr finds is just\r
121 >       * one character long ",\0").\r
122 > -     * Otherwise just return the copy of the original author name that\r
123 > +     * Otherwise just return the copy of the original address name that\r
124 >       * we just made*/\r
125 > -    comma = strchr(author,',');\r
126 > +    comma = strchr(address,',');\r
127 >      if (comma && strlen(comma) > 1) {\r
128 >       /* let's assemble what we think is the correct name */\r
129 > -     lname = comma - author;\r
130 > -     fname = strlen(author) - lname - 2;\r
131 > -     strncpy(clean_author, comma + 2, fname);\r
132 > -     *(clean_author+fname) = ' ';\r
133 > -     strncpy(clean_author + fname + 1, author, lname);\r
134 > -     *(clean_author+fname+1+lname) = '\0';\r
135 > +     lname = comma - address;\r
136 > +     fname = strlen(address) - lname - 2;\r
137 > +     strncpy(clean_address, comma + 2, fname);\r
138 > +     *(clean_address+fname) = ' ';\r
139 > +     strncpy(clean_address + fname + 1, address, lname);\r
140 > +     *(clean_address+fname+1+lname) = '\0';\r
141 >       /* make a temporary copy and see if it matches the email */\r
142 > -     test_author = talloc_strdup(thread,clean_author);\r
143 > +     test_address = talloc_strdup(thread,clean_address);\r
144 >  \r
145 > -     blank=strchr(test_author,' ');\r
146 > +     blank=strchr(test_address,' ');\r
147 >       while (blank != NULL) {\r
148 >           *blank = '.';\r
149 > -         blank=strchr(test_author,' ');\r
150 > +         blank=strchr(test_address,' ');\r
151 >       }\r
152 > -     if (strcasestr(from, test_author) == NULL)\r
153 > +     if (strcasestr(original, test_address) == NULL)\r
154 >           /* we didn't identify this as part of the email address\r
155 > -         * so let's punt and return the original author */\r
156 > -         strcpy (clean_author, author);\r
157 > +         * so let's punt and return the original address */\r
158 > +         strcpy (clean_address, address);\r
159 >      }\r
160 > -    return clean_author;\r
161 > +    return clean_address;\r
162 >  }\r
163 >  \r
164 >  /* Add 'message' as a message that belongs to 'thread'.\r
165 \r
166 -- \r
167 Austin Clements                                      MIT/'06/PhD/CSAIL\r
168 amdragon@mit.edu                           http://web.mit.edu/amdragon\r
169        Somewhere in the dream we call reality you will find me,\r
170               searching for the reality we call dreams.\r