1 Return-Path: <cworth@cworth.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 9E5F74196F2
\r
6 for <notmuch@notmuchmail.org>; Sat, 24 Apr 2010 08:30:23 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5
\r
12 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]
\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 zax3JtkQ3MKv; Sat, 24 Apr 2010 08:30:22 -0700 (PDT)
\r
17 Received: from yoom.home.cworth.org (localhost [127.0.0.1])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 7E68E431FC1;
\r
19 Sat, 24 Apr 2010 08:30:22 -0700 (PDT)
\r
20 Received: by yoom.home.cworth.org (Postfix, from userid 1000)
\r
21 id 2D45E568DEC; Sat, 24 Apr 2010 08:30:22 -0700 (PDT)
\r
22 From: Carl Worth <cworth@cworth.org>
\r
23 To: Dirk Hohndel <hohndel@infradead.org>, notmuch <notmuch@notmuchmail.org>
\r
24 Subject: Re: [PATCH] Clean up author display for some "Last, First" cases
\r
25 In-Reply-To: <m3633kyt5k.fsf@x200.gr8dns.org>
\r
26 References: <m3633kyt5k.fsf@x200.gr8dns.org>
\r
27 User-Agent: Notmuch/0.2-188-g9757095 (http://notmuchmail.org) Emacs/23.1.1
\r
29 Date: Sat, 24 Apr 2010 08:30:22 -0700
\r
30 Message-ID: <87mxwshnqp.fsf@yoom.home.cworth.org>
\r
32 Content-Type: multipart/signed; boundary="=-=-=";
\r
33 micalg=pgp-sha1; protocol="application/pgp-signature"
\r
34 X-BeenThere: notmuch@notmuchmail.org
\r
35 X-Mailman-Version: 2.1.13
\r
37 List-Id: "Use and development of the notmuch mail system."
\r
38 <notmuch.notmuchmail.org>
\r
39 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
40 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
41 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
42 List-Post: <mailto:notmuch@notmuchmail.org>
\r
43 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
44 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
45 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
46 X-List-Received-Date: Sat, 24 Apr 2010 15:30:23 -0000
\r
49 Content-Transfer-Encoding: quoted-printable
\r
51 On Wed, 21 Apr 2010 22:04:39 -0700, Dirk Hohndel <hohndel@infradead.org> wr=
\r
53 > +/* clean up the uggly "Lastname, Firstname" format that some mail systems
\r
54 > + * (most notably, Exchange) are creating to be "Firstname Lastname"=20
\r
55 > + * To make sure that we don't change other potential situations where a=
\r
57 > + * comma is in the name, we check that we match one of these patterns
\r
58 > + * "Last, First" <first.last@company.com>
\r
59 > + * "Last, First MI" <first.mi.last@company.com>
\r
61 This is an interesting idea. We could make it a little more flexible by
\r
62 doing a regexp comparison of "first.*last" against the email address,
\r
63 (perhaps people have email addresses like carl_worth@example.com?)
\r
65 > + char *cleanauthor,*testauthor;
\r
67 I'd much rather see an underscore separating two words in a single
\r
68 identifier, (so clean_author, test_author).
\r
70 > + /* let's assemble what we think is the correct name */
\r
71 > + lname =3D comma - author;
\r
72 > + fname =3D strlen(author) - lname - 2;
\r
73 > + strncpy(cleanauthor, comma + 2, fname);
\r
74 > + *(cleanauthor+fname) =3D ' ';
\r
75 > + strncpy(cleanauthor + fname + 1, author, lname);
\r
76 > + *(cleanauthor+fname+1+lname) =3D '\0';
\r
78 The comment above, ("what we think is the correct name"), didn't help me
\r
79 understand what the code is doing. And the code is hard enough to follow
\r
80 that I could really use some help. Something like:
\r
82 /* Break at comma and reverse: "Last, First etc." -> "First Last etc." */
\r
84 Lots of little additions here and there so plenty of chance for an
\r
85 off-by-one. Do we have a test case for this yet?
\r
87 > + /* make a temporary copy and see if it matches the email */
\r
88 > + testauthor =3D xstrdup(cleanauthor);
\r
90 It would be preferable to use talloc functions consistently. (Existing
\r
91 occurrences of xstrdup in the code base are for the sake of
\r
92 talloc-unfriendly glib data structures like GHashTable.)
\r
94 As is, testauthor is leaking.
\r
99 Content-Type: application/pgp-signature
\r
101 -----BEGIN PGP SIGNATURE-----
\r
102 Version: GnuPG v1.4.10 (GNU/Linux)
\r
104 iD8DBQFL0w6O6JDdNq8qSWgRAjn0AJ99uMKCZiebcaR5Z9iZ2C+xgPbgWgCgonzU
\r
105 EUZRUe/OixCkPORuRUXLJBE=
\r
107 -----END PGP SIGNATURE-----
\r