unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jameson Graef Rollins <jrollins@finestructure.net>
To: Notmuch Mail <notmuch@notmuchmail.org>
Subject: [PATCH 04/11] lib: remove no longer needed author-specific thread functions
Date: Sun, 19 Aug 2012 18:52:43 -0700	[thread overview]
Message-ID: <1345427570-26518-5-git-send-email-jrollins@finestructure.net> (raw)
In-Reply-To: <1345427570-26518-4-git-send-email-jrollins@finestructure.net>

The _add_author, _add_matched_author, and
_resolve_thread_authors_string functions have been replaced by the
more generic _address functions that utilize the new
notmuch_thread_addresses_t.
---
 lib/thread.cc |   91 ---------------------------------------------------------
 1 file changed, 91 deletions(-)

diff --git a/lib/thread.cc b/lib/thread.cc
index b53ccb0..757e143 100644
--- a/lib/thread.cc
+++ b/lib/thread.cc
@@ -143,97 +143,6 @@ _resolve_thread_addresses_string (notmuch_thread_addresses_t *addresses)
     }
 }
 
-/* Add each author of the thread to the thread's authors_hash and to
- * the thread's authors_array. */
-static void
-_thread_add_author (notmuch_thread_t *thread,
-		    const char *author)
-{
-    char *author_copy;
-
-    if (author == NULL)
-	return;
-
-    if (g_hash_table_lookup_extended (thread->authors_hash,
-				      author, NULL, NULL))
-	return;
-
-    author_copy = talloc_strdup (thread, author);
-
-    g_hash_table_insert (thread->authors_hash, author_copy, NULL);
-
-    g_ptr_array_add (thread->authors_array, author_copy);
-}
-
-/* Add each matched author of the thread to the thread's
- * matched_authors_hash and to the thread's matched_authors_array. */
-static void
-_thread_add_matched_author (notmuch_thread_t *thread,
-			    const char *author)
-{
-    char *author_copy;
-
-    if (author == NULL)
-	return;
-
-    if (g_hash_table_lookup_extended (thread->matched_authors_hash,
-				      author, NULL, NULL))
-	return;
-
-    author_copy = talloc_strdup (thread, author);
-
-    g_hash_table_insert (thread->matched_authors_hash, author_copy, NULL);
-
-    g_ptr_array_add (thread->matched_authors_array, author_copy);
-}
-
-/* Construct an authors string from matched_authors_array and
- * authors_array. The string contains matched authors first, then
- * non-matched authors (with the two groups separated by '|'). Within
- * each group, authors are listed in date order. */
-static void
-_resolve_thread_authors_string (notmuch_thread_t *thread)
-{
-    unsigned int i;
-    char *author;
-    int first_non_matched_author = 1;
-
-    /* First, list all matched authors in date order. */
-    for (i = 0; i < thread->matched_authors_array->len; i++) {
-	author = (char *) g_ptr_array_index (thread->matched_authors_array, i);
-	if (thread->authors)
-	    thread->authors = talloc_asprintf (thread, "%s, %s",
-					       thread->authors,
-					       author);
-	else
-	    thread->authors = author;
-    }
-
-    /* Next, append any non-matched authors that haven't already appeared. */
-    for (i = 0; i < thread->authors_array->len; i++) {
-	author = (char *) g_ptr_array_index (thread->authors_array, i);
-	if (g_hash_table_lookup_extended (thread->matched_authors_hash,
-					  author, NULL, NULL))
-	    continue;
-	if (first_non_matched_author) {
-	    thread->authors = talloc_asprintf (thread, "%s| %s",
-					       thread->authors,
-					       author);
-	} else {
-	    thread->authors = talloc_asprintf (thread, "%s, %s",
-					       thread->authors,
-					       author);
-	}
-
-	first_non_matched_author = 0;
-    }
-
-    g_ptr_array_free (thread->authors_array, TRUE);
-    thread->authors_array = NULL;
-    g_ptr_array_free (thread->matched_authors_array, TRUE);
-    thread->matched_authors_array = NULL;
-}
-
 /* clean up the ugly "Lastname, Firstname" format that some mail systems
  * (most notably, Exchange) are creating to be "Firstname Lastname"
  * To make sure that we don't change other potential situations where a
-- 
1.7.10.4

  reply	other threads:[~2012-08-20  1:53 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-20  1:52 [PATCH 00/11] add recipients to search output Jameson Graef Rollins
2012-08-20  1:52 ` [PATCH 01/11] lib: new thread addresses structure Jameson Graef Rollins
2012-08-20  1:52   ` [PATCH 02/11] lib: use new addresses structure for thread authors Jameson Graef Rollins
2012-08-20  1:52     ` [PATCH 03/11] lib: give _thread_cleanup_author a more generic name Jameson Graef Rollins
2012-08-20  1:52       ` Jameson Graef Rollins [this message]
2012-08-20  1:52         ` [PATCH 05/11] lib: add ability to store recipients in message structure Jameson Graef Rollins
2012-08-20  1:52           ` [PATCH 06/11] lib: store thread recipients in thread structure Jameson Graef Rollins
2012-08-20  1:52             ` [PATCH 07/11] test: search recipient output Jameson Graef Rollins
2012-08-20  1:52               ` [PATCH 08/11] cli: add thread recipients to search output Jameson Graef Rollins
2012-08-20  1:52                 ` [PATCH 09/11] emacs: add ability to show recipients instead of author in search Jameson Graef Rollins
2012-08-20  1:52                   ` [PATCH 10/11] emacs: add function to toggle showing authors/recipients " Jameson Graef Rollins
2012-08-20  1:52                     ` [PATCH 11/11] lib: add recipients to database Jameson Graef Rollins
2012-08-31 21:34                       ` Michal Sojka
2012-08-31 21:00                 ` [PATCH 08/11] cli: add thread recipients to search output Michal Sojka
2012-08-31 20:44             ` [PATCH 06/11] lib: store thread recipients in thread structure Michal Sojka
2012-09-02  7:52             ` Mark Walters
2012-09-08 17:25             ` Austin Clements
2012-08-31 20:19           ` [PATCH 05/11] lib: add ability to store recipients in message structure Michal Sojka
2012-09-08 17:24           ` Austin Clements
2012-09-08 17:25       ` [PATCH 03/11] lib: give _thread_cleanup_author a more generic name Austin Clements
2012-09-08 17:24     ` [PATCH 02/11] lib: use new addresses structure for thread authors Austin Clements
2012-08-30 15:38   ` [PATCH 01/11] lib: new thread addresses structure Michal Sojka
2012-08-30 16:33     ` Jameson Graef Rollins
2012-09-08 17:24   ` Austin Clements
2012-08-22 20:43 ` [PATCH 00/11] add recipients to search output Jameson Graef Rollins
2012-08-23  7:21 ` Tomi Ollila
2012-09-08 17:23 ` Austin Clements

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1345427570-26518-5-git-send-email-jrollins@finestructure.net \
    --to=jrollins@finestructure.net \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).