1 Return-Path: <awg@lagos.xvx.ca>
\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 25FCE431FAF
\r
6 for <notmuch@notmuchmail.org>; Wed, 30 Jan 2013 15:38:27 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 FAaJzPWGC3t3 for <notmuch@notmuchmail.org>;
\r
16 Wed, 30 Jan 2013 15:38:25 -0800 (PST)
\r
17 X-Greylist: delayed 581 seconds by postgrey-1.32 at olra;
\r
18 Wed, 30 Jan 2013 15:38:25 PST
\r
19 Received: from smtp-out-05.shaw.ca (smtp-out-05.shaw.ca [64.59.134.13])
\r
20 by olra.theworths.org (Postfix) with ESMTP id CDA7F431FAE
\r
21 for <notmuch@notmuchmail.org>; Wed, 30 Jan 2013 15:38:25 -0800 (PST)
\r
22 X-Cloudmark-SP-Filtered: true
\r
23 X-Cloudmark-SP-Result: v=1.1 cv=/OolT88hxzZB4/D8S1pLLnpaRVcdzwgG3HupJc0czqk=
\r
25 a=flFsAdDc1OsA:10 a=BLceEmwcHowA:10 a=gumk1giGF0obp6xRQyl7Yg==:17
\r
26 a=A1X0JdhQAAAA:8 a=m7NE1Zox25VmYJf3OS4A:9 a=9Mll2h4CvCUA:10
\r
27 a=Y6qChIQXU1wA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117
\r
28 Received: from unknown (HELO lagos.xvx.ca) ([68.150.39.45])
\r
29 by smtp-out-05.shaw.ca with ESMTP; 30 Jan 2013 16:28:41 -0700
\r
30 Received: by lagos.xvx.ca (Postfix, from userid 1000)
\r
31 id E48B4800214E; Wed, 30 Jan 2013 16:28:37 -0700 (MST)
\r
32 From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>
\r
33 To: notmuch@notmuchmail.org
\r
34 Subject: [PATCH] lib: Fix name reordering to handle commas without spaces
\r
35 Date: Wed, 30 Jan 2013 16:28:30 -0700
\r
36 Message-Id: <1359588510-20106-1-git-send-email-awg+notmuch@xvx.ca>
\r
37 X-Mailer: git-send-email 1.7.9.5
\r
38 X-BeenThere: notmuch@notmuchmail.org
\r
39 X-Mailman-Version: 2.1.13
\r
41 List-Id: "Use and development of the notmuch mail system."
\r
42 <notmuch.notmuchmail.org>
\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
44 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
46 List-Post: <mailto:notmuch@notmuchmail.org>
\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
49 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
50 X-List-Received-Date: Wed, 30 Jan 2013 23:38:27 -0000
\r
52 Notmuch automatically re-orders names of the format "Last, First" to
\r
53 "First Last" when the associated email address is
\r
54 First.Last@example.com. But, if a name is of the format "Last,First"
\r
55 then notmuch will format the name as "irst Last". Fix this by checking
\r
56 for a space when doing the reordering.
\r
58 lib/thread.cc | 9 +++++++--
\r
59 1 file changed, 7 insertions(+), 2 deletions(-)
\r
61 diff --git a/lib/thread.cc b/lib/thread.cc
\r
62 index e976d64..005b355 100644
\r
65 @@ -186,8 +186,13 @@ _thread_cleanup_author (notmuch_thread_t *thread,
\r
66 if (comma && strlen(comma) > 1) {
\r
67 /* let's assemble what we think is the correct name */
\r
68 lname = comma - author;
\r
69 - fname = strlen(author) - lname - 2;
\r
70 - strncpy(clean_author, comma + 2, fname);
\r
71 + if (*(comma + 1) == ' ') {
\r
72 + fname = strlen(author) - lname - 2;
\r
73 + strncpy(clean_author, comma + 2, fname);
\r
75 + fname = strlen(author) - lname - 1;
\r
76 + strncpy(clean_author, comma + 1, fname);
\r
78 *(clean_author+fname) = ' ';
\r
79 strncpy(clean_author + fname + 1, author, lname);
\r
80 *(clean_author+fname+1+lname) = '\0';
\r