Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 9B9C4431FB6 for ; Tue, 5 Feb 2013 10:08:15 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] 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 tK43rzV-Srlq for ; Tue, 5 Feb 2013 10:08:14 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id C18AB431FAF for ; Tue, 5 Feb 2013 10:08:14 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 9E8641000CA; Tue, 5 Feb 2013 20:08:02 +0200 (EET) From: Tomi Ollila To: Adam Wolfe Gordon , notmuch@notmuchmail.org Subject: Re: [PATCH] lib: Fix name reordering to handle commas without spaces In-Reply-To: <1359588510-20106-1-git-send-email-awg+notmuch@xvx.ca> References: <1359588510-20106-1-git-send-email-awg+notmuch@xvx.ca> User-Agent: Notmuch/0.15+20~g7e29ae9 (http://notmuchmail.org) Emacs/24.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain 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: Tue, 05 Feb 2013 18:08:15 -0000 On Thu, Jan 31 2013, Adam Wolfe Gordon wrote: > Notmuch automatically re-orders names of the format "Last, First" to > "First Last" when the associated email address is > First.Last@example.com. But, if a name is of the format "Last,First" > then notmuch will format the name as "irst Last". Fix this by checking > for a space when doing the reordering. Looks good to me, but should this check any (1-n) amount of whitespace ? Tomi > --- > lib/thread.cc | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/lib/thread.cc b/lib/thread.cc > index e976d64..005b355 100644 > --- a/lib/thread.cc > +++ b/lib/thread.cc > @@ -186,8 +186,13 @@ _thread_cleanup_author (notmuch_thread_t *thread, > if (comma && strlen(comma) > 1) { > /* let's assemble what we think is the correct name */ > lname = comma - author; > - fname = strlen(author) - lname - 2; > - strncpy(clean_author, comma + 2, fname); > + if (*(comma + 1) == ' ') { > + fname = strlen(author) - lname - 2; > + strncpy(clean_author, comma + 2, fname); > + } else { > + fname = strlen(author) - lname - 1; > + strncpy(clean_author, comma + 1, fname); > + } > *(clean_author+fname) = ' '; > strncpy(clean_author + fname + 1, author, lname); > *(clean_author+fname+1+lname) = '\0'; > -- > 1.7.9.5 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch