From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id AB655431FBF for ; Sat, 8 Sep 2012 10:25:21 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 L9PdA4g8-Lll for ; Sat, 8 Sep 2012 10:25:19 -0700 (PDT) Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU [18.9.25.14]) by olra.theworths.org (Postfix) with ESMTP id 61D6F431FC0 for ; Sat, 8 Sep 2012 10:25:16 -0700 (PDT) X-AuditID: 1209190e-b7f256d000000c6a-61-504b7f7bc471 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36]) by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP id F6.78.03178.B7F7B405; Sat, 8 Sep 2012 13:25:16 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q88HPFQL014468; Sat, 8 Sep 2012 13:25:15 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q88HPE9w026436 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sat, 8 Sep 2012 13:25:15 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1TAOmQ-00061x-9K; Sat, 08 Sep 2012 13:25:14 -0400 Date: Sat, 8 Sep 2012 13:25:14 -0400 From: Austin Clements To: Jameson Graef Rollins Subject: Re: [PATCH 03/11] lib: give _thread_cleanup_author a more generic name Message-ID: <20120908172514.GA22336@mit.edu> References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net> <1345427570-26518-2-git-send-email-jrollins@finestructure.net> <1345427570-26518-3-git-send-email-jrollins@finestructure.net> <1345427570-26518-4-git-send-email-jrollins@finestructure.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1345427570-26518-4-git-send-email-jrollins@finestructure.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsUixG6noltT7x1gcDfRYs8+L4vrN2cyOzB5 3D3N5fFs1S3mAKYoLpuU1JzMstQifbsErox1R+4zF7TIVDxYv42tgbFbtIuRk0NCwESic9tJ ZghbTOLCvfVsILaQwD5Gif3zuboYuYDs9YwSU+/uYIZwTjBJ3HncyQxRtYRR4nZnbhcjBweL gIrE6bUeIGE2AQ2JbfuXM4LYIgJmEj1f/oDZzAJaEls3fgCzhQUCJXrvLWcBsXkFdCTuf5jC AjGyl0liyc16iLigxMmZT1hgem/8e8kEsopZQFpi+T8OkDCngLfEpO/tYDeLAl0w5eQ2tgmM QrOQdM9C0j0LoXsBI/MqRtmU3Crd3MTMnOLUZN3i5MS8vNQiXWO93MwSvdSU0k2MoGDmlOTb wfj1oNIhRgEORiUe3g1yXgFCrIllxZW5hxglOZiURHl313gHCPEl5adUZiQWZ8QXleakFh9i lOBgVhLhvZ4OlONNSaysSi3Kh0lJc7AoifNeSbnpLySQnliSmp2aWpBaBJOV4eBQkuC1rQNq FCxKTU+tSMvMKUFIM3FwggznARpeAFLDW1yQmFucmQ6RP8WoKCXO6w1ykQBIIqM0D64Xlmxe MYoDvSIMsYIHmKjgul8BDWYCGizyzANkcEkiQkqqgZF175zCF0wHao67SJT1BrzoPnidn0vw 4Z9a8aP8kbfatm/w4J8icN70xUtdsd8zviV1SywSWyeXnDv92IoKkzPr58cycvJGN+ZUzaxy Ftc5N0V9zQT/ALXI7aHmLv++n6nvylaWD/u8TlLuV9dRXROhyqWqy26fXfT1rrDAD7aehOV7 Vy2SuqrEUpyRaKjFXFScCABn4DXFEQMAAA== Cc: Notmuch Mail 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: Sat, 08 Sep 2012 17:25:22 -0000 Should this patch also rename calls to this function? Quoth Jameson Graef Rollins on Aug 19 at 6:52 pm: > We will use this for cleaning non-author address fields, so we give it > the more generic name _thread_cleanup_address. > --- > lib/thread.cc | 43 ++++++++++++++++++++++--------------------- > 1 file changed, 22 insertions(+), 21 deletions(-) > > diff --git a/lib/thread.cc b/lib/thread.cc > index 9e0e5cb..b53ccb0 100644 > --- a/lib/thread.cc > +++ b/lib/thread.cc > @@ -242,48 +242,49 @@ _resolve_thread_authors_string (notmuch_thread_t *thread) > * "Last, First MI" > */ > static char * > -_thread_cleanup_author (notmuch_thread_t *thread, > - const char *author, const char *from) > +_thread_cleanup_address (notmuch_thread_t *thread, > + const char *address, > + const char *original) > { > - char *clean_author,*test_author; > + char *clean_address,*test_address; > const char *comma; > char *blank; > int fname,lname; > > - if (author == NULL) > + if (address == NULL) > return NULL; > - clean_author = talloc_strdup(thread, author); > - if (clean_author == NULL) > + clean_address = talloc_strdup(thread, address); > + if (clean_address == NULL) > return NULL; > /* check if there's a comma in the name and that there's a > * component of the name behind it (so the name doesn't end with > * the comma - in which case the string that strchr finds is just > * one character long ",\0"). > - * Otherwise just return the copy of the original author name that > + * Otherwise just return the copy of the original address name that > * we just made*/ > - comma = strchr(author,','); > + comma = strchr(address,','); > 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); > - *(clean_author+fname) = ' '; > - strncpy(clean_author + fname + 1, author, lname); > - *(clean_author+fname+1+lname) = '\0'; > + lname = comma - address; > + fname = strlen(address) - lname - 2; > + strncpy(clean_address, comma + 2, fname); > + *(clean_address+fname) = ' '; > + strncpy(clean_address + fname + 1, address, lname); > + *(clean_address+fname+1+lname) = '\0'; > /* make a temporary copy and see if it matches the email */ > - test_author = talloc_strdup(thread,clean_author); > + test_address = talloc_strdup(thread,clean_address); > > - blank=strchr(test_author,' '); > + blank=strchr(test_address,' '); > while (blank != NULL) { > *blank = '.'; > - blank=strchr(test_author,' '); > + blank=strchr(test_address,' '); > } > - if (strcasestr(from, test_author) == NULL) > + if (strcasestr(original, test_address) == NULL) > /* we didn't identify this as part of the email address > - * so let's punt and return the original author */ > - strcpy (clean_author, author); > + * so let's punt and return the original address */ > + strcpy (clean_address, address); > } > - return clean_author; > + return clean_address; > } > > /* Add 'message' as a message that belongs to 'thread'. -- Austin Clements MIT/'06/PhD/CSAIL amdragon@mit.edu http://web.mit.edu/amdragon Somewhere in the dream we call reality you will find me, searching for the reality we call dreams.