aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder-thread.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-12-24 08:46:20 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-12-24 08:46:20 +0800
commit6de256c2a2b23f30d35e4a2213ad5839bf141d06 (patch)
treea34d8be64c0718070c4e1ea9548282912f37b387 /camel/camel-folder-thread.c
parent6183d89039ba67a7f3869f460c13aff09a548471 (diff)
downloadgsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.gz
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.tar.zst
gsoc2013-evolution-6de256c2a2b23f30d35e4a2213ad5839bf141d06.zip
Lock the command channel while searching. (imap_body_contains): If
2000-12-24 Not Zed <NotZed@HelixCode.com> * providers/imap/camel-imap-search.c (imap_body_contains): Lock the command channel while searching. (imap_body_contains): If performing a whole uid search, then add references to our own summary items, dont look it up in the folder. This way they can't vanish unexpectedly. * providers/imap/camel-imap-folder.h (CamelImapFolder): Added a private field. * providers/imap/camel-imap-private.h: Added lock for imap searches. * Merge from camel-mt-branch. * providers/imap/camel-imap-folder.c (imap_update_summary): Merge fix, use the folder->summary. (imap_get_message_flags, imap_set_message_flags, imap_get_message_user_flag, imap_set_message_user_flag): Removed again. (camel_imap_folder_init): Setup private data/lock. (imap_finalize): Free private data/search lock. (imap_search_free): Lock the search_lock. (imap_search_by_expression): Lock the search lock when using the search object. Also copy/ref hte summary, rather than getting it directly. (imap_refresh_info): Free any info lookups. Use folder->summary not imap_folder->summary. And lock around commands. svn path=/trunk/; revision=7150
Diffstat (limited to 'camel/camel-folder-thread.c')
-rw-r--r--camel/camel-folder-thread.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/camel/camel-folder-thread.c b/camel/camel-folder-thread.c
index 4b6a72053e..c83c33687d 100644
--- a/camel/camel-folder-thread.c
+++ b/camel/camel-folder-thread.c
@@ -433,7 +433,8 @@ camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids)
int i;
CamelFolderThreadNode *c, *child, *head;
CamelFolderThread *thread;
- GPtrArray *myuids;
+ GHashTable *wanted = NULL;
+ GPtrArray *summary;
#ifdef TIMEIT
struct timeval start, end;
@@ -445,22 +446,26 @@ camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids)
thread = g_malloc(sizeof(*thread));
thread->tree = NULL;
thread->node_chunks = e_memchunk_new(32, sizeof(CamelFolderThreadNode));
+ thread->folder = folder;
+ camel_object_ref((CamelObject *)folder);
+
+ /* wanted is the list of what we want, we put it in a hash for quick lookup */
+ if (uids) {
+ wanted = g_hash_table_new(g_str_hash, g_str_equal);
+ for (i=0;i<uids->len;i++)
+ g_hash_table_insert(wanted, uids->pdata[i], uids->pdata[i]);
+ }
- if (uids == NULL)
- uids = myuids = camel_folder_get_uids(folder);
- else
- myuids = NULL;
-
+ thread->summary = summary = camel_folder_get_summary(folder);
+
id_table = g_hash_table_new((GHashFunc)id_hash, (GCompareFunc)id_equal);
no_id_table = g_hash_table_new(NULL, NULL);
- for (i=0;i<uids->len;i++) {
- const CamelMessageInfo *mi;
- mi = camel_folder_get_message_info(folder, uids->pdata[i]);
+ for (i=0;i<summary->len;i++) {
+ CamelMessageInfo *mi = summary->pdata[i];
+ const char *uid = camel_message_info_uid(mi);
- if (mi == NULL) {
- g_warning("Folder doesn't contain uid %s", (char *)uids->pdata[i]);
+ if (wanted && g_hash_table_lookup(wanted, uid) == 0)
continue;
- }
if (mi->message_id.id.id) {
c = g_hash_table_lookup(id_table, &mi->message_id);
@@ -540,9 +545,6 @@ camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids)
uids->len, diff / 1000, diff % 1000);
#endif
- if (myuids)
- camel_folder_free_uids(folder, myuids);
-
return thread;
}
@@ -555,6 +557,8 @@ camel_folder_thread_messages_new(CamelFolder *folder, GPtrArray *uids)
void
camel_folder_thread_messages_destroy(CamelFolderThread *thread)
{
+ camel_folder_free_summary(thread->folder, thread->summary);
+ camel_object_unref((CamelObject *)thread->folder);
e_memchunk_destroy(thread->node_chunks);
g_free(thread);
}