--- /dev/null
+Return-Path: <jrollins@finestructure.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id C2A69431FBD\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:15 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.3\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id jIgH5m0kamSE for <notmuch@notmuchmail.org>;\r
+ Sun, 19 Aug 2012 18:53:14 -0700 (PDT)\r
+Received: from outgoing-mail.its.caltech.edu (outgoing-mail.its.caltech.edu\r
+ [131.215.239.19])\r
+ by olra.theworths.org (Postfix) with ESMTP id 8CE8E431FC4\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:08 -0700 (PDT)\r
+Received: from fire-doxen.imss.caltech.edu (localhost [127.0.0.1])\r
+ by fire-doxen-postvirus (Postfix) with ESMTP id 2EC072E50B36\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:06 -0700 (PDT)\r
+X-Spam-Scanned: at Caltech-IMSS on fire-doxen by amavisd-new\r
+Received: from finestructure.net (unknown [76.89.192.57])\r
+ (Authenticated sender: jrollins)\r
+ by fire-doxen-submit (Postfix) with ESMTP id 4C793328012\r
+ for <notmuch@notmuchmail.org>; Sun, 19 Aug 2012 18:53:04 -0700 (PDT)\r
+Received: by finestructure.net (Postfix, from userid 1000)\r
+ id CE8AF88B; Sun, 19 Aug 2012 18:53:03 -0700 (PDT)\r
+From: Jameson Graef Rollins <jrollins@finestructure.net>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 03/11] lib: give _thread_cleanup_author a more generic name\r
+Date: Sun, 19 Aug 2012 18:52:42 -0700\r
+Message-Id: <1345427570-26518-4-git-send-email-jrollins@finestructure.net>\r
+X-Mailer: git-send-email 1.7.10.4\r
+In-Reply-To: <1345427570-26518-3-git-send-email-jrollins@finestructure.net>\r
+References: <1345427570-26518-1-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-2-git-send-email-jrollins@finestructure.net>\r
+ <1345427570-26518-3-git-send-email-jrollins@finestructure.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Mon, 20 Aug 2012 01:53:16 -0000\r
+\r
+We will use this for cleaning non-author address fields, so we give it\r
+the more generic name _thread_cleanup_address.\r
+---\r
+ lib/thread.cc | 43 ++++++++++++++++++++++---------------------\r
+ 1 file changed, 22 insertions(+), 21 deletions(-)\r
+\r
+diff --git a/lib/thread.cc b/lib/thread.cc\r
+index 9e0e5cb..b53ccb0 100644\r
+--- a/lib/thread.cc\r
++++ b/lib/thread.cc\r
+@@ -242,48 +242,49 @@ _resolve_thread_authors_string (notmuch_thread_t *thread)\r
+ * "Last, First MI" <first.mi.last@company.com>\r
+ */\r
+ static char *\r
+-_thread_cleanup_author (notmuch_thread_t *thread,\r
+- const char *author, const char *from)\r
++_thread_cleanup_address (notmuch_thread_t *thread,\r
++ const char *address,\r
++ const char *original)\r
+ {\r
+- char *clean_author,*test_author;\r
++ char *clean_address,*test_address;\r
+ const char *comma;\r
+ char *blank;\r
+ int fname,lname;\r
+ \r
+- if (author == NULL)\r
++ if (address == NULL)\r
+ return NULL;\r
+- clean_author = talloc_strdup(thread, author);\r
+- if (clean_author == NULL)\r
++ clean_address = talloc_strdup(thread, address);\r
++ if (clean_address == NULL)\r
+ return NULL;\r
+ /* check if there's a comma in the name and that there's a\r
+ * component of the name behind it (so the name doesn't end with\r
+ * the comma - in which case the string that strchr finds is just\r
+ * one character long ",\0").\r
+- * Otherwise just return the copy of the original author name that\r
++ * Otherwise just return the copy of the original address name that\r
+ * we just made*/\r
+- comma = strchr(author,',');\r
++ comma = strchr(address,',');\r
+ if (comma && strlen(comma) > 1) {\r
+ /* let's assemble what we think is the correct name */\r
+- lname = comma - author;\r
+- fname = strlen(author) - lname - 2;\r
+- strncpy(clean_author, comma + 2, fname);\r
+- *(clean_author+fname) = ' ';\r
+- strncpy(clean_author + fname + 1, author, lname);\r
+- *(clean_author+fname+1+lname) = '\0';\r
++ lname = comma - address;\r
++ fname = strlen(address) - lname - 2;\r
++ strncpy(clean_address, comma + 2, fname);\r
++ *(clean_address+fname) = ' ';\r
++ strncpy(clean_address + fname + 1, address, lname);\r
++ *(clean_address+fname+1+lname) = '\0';\r
+ /* make a temporary copy and see if it matches the email */\r
+- test_author = talloc_strdup(thread,clean_author);\r
++ test_address = talloc_strdup(thread,clean_address);\r
+ \r
+- blank=strchr(test_author,' ');\r
++ blank=strchr(test_address,' ');\r
+ while (blank != NULL) {\r
+ *blank = '.';\r
+- blank=strchr(test_author,' ');\r
++ blank=strchr(test_address,' ');\r
+ }\r
+- if (strcasestr(from, test_author) == NULL)\r
++ if (strcasestr(original, test_address) == NULL)\r
+ /* we didn't identify this as part of the email address\r
+- * so let's punt and return the original author */\r
+- strcpy (clean_author, author);\r
++ * so let's punt and return the original address */\r
++ strcpy (clean_address, address);\r
+ }\r
+- return clean_author;\r
++ return clean_address;\r
+ }\r
+ \r
+ /* Add 'message' as a message that belongs to 'thread'.\r
+-- \r
+1.7.10.4\r
+\r