From dedec6a7084cc67aa79cd884f47e6a2d8ee818db Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 12 May 2004 07:12:27 +0000 Subject: changed to match_threads. (camel_folder_search_search): remove thread 2004-05-12 Not Zed * camel-folder-search.c (search_threads): changed to match_threads. (camel_folder_search_search): remove thread matching stuff from here. 2004-05-06 Not Zed * camel-digest-folder.c (digest_search_by_expression) (digest_search_by_uids): * providers/nntp/camel-nntp-folder.c (nntp_folder_search_by_expression) (nntp_folder_search_by_uids): * providers/imap/camel-imap-folder.c (imap_search_by_expression) (imap_search_by_uids): * providers/local/camel-local-folder.c (local_search_by_expression) (local_search_by_uids): use camel_folder_search_search & some minor cleanups. * camel-folder-search.c (search_threads): keep track of the match threads option for this search. (camel_folder_search_match_expression): Removed, not used anymore. (camel_folder_search_search): new api entry point for searching, a bit easier to use and needed for thread matching. * camel-folder-search.c (camel_folder_search_search): new search api entry point, take a full summary and optionally a subset of uids to match against. (search_match_all): use the uids' passed in to only search a subset of uid's. svn path=/trunk/; revision=25876 --- camel/providers/imap/camel-imap-folder.c | 37 +++++----------------------- camel/providers/local/camel-local-folder.c | 39 +++++------------------------- camel/providers/nntp/camel-nntp-folder.c | 38 ++++++----------------------- 3 files changed, 19 insertions(+), 95 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 4e4745c6ec..7915441047 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -1574,7 +1574,7 @@ static GPtrArray * imap_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); - GPtrArray *matches, *summary; + GPtrArray *matches; /* we could get around this by creating a new search object each time, but i doubt its worth it since any long operation would lock the @@ -1582,14 +1582,10 @@ imap_search_by_expression (CamelFolder *folder, const char *expression, CamelExc CAMEL_IMAP_FOLDER_LOCK(folder, search_lock); camel_folder_search_set_folder (imap_folder->search, folder); - summary = camel_folder_get_summary(folder); - camel_folder_search_set_summary(imap_folder->search, summary); - matches = camel_folder_search_execute_expression (imap_folder->search, expression, ex); + matches = camel_folder_search_search(imap_folder->search, expression, NULL, ex); CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock); - camel_folder_free_summary(folder, summary); - return matches; } @@ -1597,39 +1593,18 @@ static GPtrArray * imap_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER(folder); - GPtrArray *summary, *matches; - int i; - - /* NOTE: could get away without the search lock by creating a new - search object each time */ - - qsort (uids->pdata, uids->len, sizeof (void *), uid_compar); - - summary = g_ptr_array_new(); - for (i=0;ilen;i++) { - CamelMessageInfo *info; - - info = camel_folder_get_message_info(folder, uids->pdata[i]); - if (info) - g_ptr_array_add(summary, info); - } + GPtrArray *matches; - if (summary->len == 0) - return summary; + if (uids->len == 0) + return g_ptr_array_new(); CAMEL_IMAP_FOLDER_LOCK(folder, search_lock); camel_folder_search_set_folder(imap_folder->search, folder); - camel_folder_search_set_summary(imap_folder->search, summary); - - matches = camel_folder_search_execute_expression(imap_folder->search, expression, ex); + matches = camel_folder_search_search(imap_folder->search, expression, uids, ex); CAMEL_IMAP_FOLDER_UNLOCK(folder, search_lock); - for (i=0;ilen;i++) - camel_folder_free_message_info(folder, summary->pdata[i]); - g_ptr_array_free(summary, TRUE); - return matches; } diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c index bd9d259dce..2c352c749d 100644 --- a/camel/providers/local/camel-local-folder.c +++ b/camel/providers/local/camel-local-folder.c @@ -575,10 +575,7 @@ static GPtrArray * local_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex) { CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(folder); - GPtrArray *summary, *matches; - - /* NOTE: could get away without the search lock by creating a new - search object each time */ + GPtrArray *matches; CAMEL_LOCAL_FOLDER_LOCK(folder, search_lock); @@ -587,15 +584,10 @@ local_search_by_expression(CamelFolder *folder, const char *expression, CamelExc camel_folder_search_set_folder(local_folder->search, folder); camel_folder_search_set_body_index(local_folder->search, local_folder->index); - summary = camel_folder_get_summary(folder); - camel_folder_search_set_summary(local_folder->search, summary); - - matches = camel_folder_search_execute_expression(local_folder->search, expression, ex); + matches = camel_folder_search_search(local_folder->search, expression, NULL, ex); CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock); - camel_folder_free_summary(folder, summary); - return matches; } @@ -603,23 +595,10 @@ static GPtrArray * local_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex) { CamelLocalFolder *local_folder = CAMEL_LOCAL_FOLDER(folder); - GPtrArray *summary, *matches; - int i; - - /* NOTE: could get away without the search lock by creating a new - search object each time */ + GPtrArray *matches; - summary = g_ptr_array_new(); - for (i=0;ilen;i++) { - CamelMessageInfo *info; - - info = camel_folder_get_message_info(folder, uids->pdata[i]); - if (info) - g_ptr_array_add(summary, info); - } - - if (summary->len == 0) - return summary; + if (uids->len == 0) + return g_ptr_array_new(); CAMEL_LOCAL_FOLDER_LOCK(folder, search_lock); @@ -628,16 +607,10 @@ local_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uid camel_folder_search_set_folder(local_folder->search, folder); camel_folder_search_set_body_index(local_folder->search, local_folder->index); - camel_folder_search_set_summary(local_folder->search, summary); - - matches = camel_folder_search_execute_expression(local_folder->search, expression, ex); + matches = camel_folder_search_search(local_folder->search, expression, uids, ex); CAMEL_LOCAL_FOLDER_UNLOCK(folder, search_lock); - for (i=0;ilen;i++) - camel_folder_free_message_info(folder, summary->pdata[i]); - g_ptr_array_free(summary, TRUE); - return matches; } diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 9fc236e215..4762cf974a 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -287,7 +287,7 @@ static GPtrArray* nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, CamelException *ex) { CamelNNTPFolder *nntp_folder = CAMEL_NNTP_FOLDER (folder); - GPtrArray *matches, *summary; + GPtrArray *matches; CAMEL_NNTP_FOLDER_LOCK(nntp_folder, search_lock); @@ -295,15 +295,10 @@ nntp_folder_search_by_expression (CamelFolder *folder, const char *expression, C nntp_folder->search = camel_folder_search_new (); camel_folder_search_set_folder (nntp_folder->search, folder); - summary = camel_folder_get_summary (folder); - camel_folder_search_set_summary (nntp_folder->search, summary); - - matches = camel_folder_search_execute_expression (nntp_folder->search, expression, ex); + matches = camel_folder_search_search(nntp_folder->search, expression, NULL, ex); CAMEL_NNTP_FOLDER_UNLOCK(nntp_folder, search_lock); - camel_folder_free_summary (folder, summary); - return matches; } @@ -311,22 +306,10 @@ static GPtrArray * nntp_folder_search_by_uids (CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex) { CamelNNTPFolder *nntp_folder = (CamelNNTPFolder *) folder; - GPtrArray *summary, *matches; - int i; - - /* NOTE: could get away without the search lock by creating a new - search object each time */ - - summary = g_ptr_array_new (); - for (i = 0; i < uids->len; i++) { - CamelMessageInfo *info; - - if ((info = camel_folder_get_message_info (folder, uids->pdata[i]))) - g_ptr_array_add (summary, info); - } - - if (summary->len == 0) - return summary; + GPtrArray *matches; + + if (uids->len == 0) + return g_ptr_array_new(); CAMEL_NNTP_FOLDER_LOCK(folder, search_lock); @@ -334,17 +317,10 @@ nntp_folder_search_by_uids (CamelFolder *folder, const char *expression, GPtrArr nntp_folder->search = camel_folder_search_new (); camel_folder_search_set_folder (nntp_folder->search, folder); - camel_folder_search_set_summary (nntp_folder->search, summary); - - matches = camel_folder_search_execute_expression (nntp_folder->search, expression, ex); + matches = camel_folder_search_search(nntp_folder->search, expression, uids, ex); CAMEL_NNTP_FOLDER_UNLOCK(folder, search_lock); - for (i = 0; i < summary->len; i++) - camel_folder_free_message_info (folder, summary->pdata[i]); - - g_ptr_array_free (summary, TRUE); - return matches; } -- cgit v1.2.3