[PATCH 04/11] lib: remove no longer needed author-specific thread functions
Jameson Graef Rollins
jrollins at finestructure.net
Sun Aug 19 18:52:43 PDT 2012
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
More information about the notmuch
mailing list