aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-local-folder.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/local/camel-local-folder.c')
-rw-r--r--camel/providers/local/camel-local-folder.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 43622eb23a..27b49a5c70 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -62,6 +62,7 @@ static void local_sync(CamelFolder *folder, gboolean expunge, CamelException *ex
static void local_expunge(CamelFolder *folder, CamelException *ex);
static GPtrArray *local_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
+static GPtrArray *local_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids, CamelException *ex);
static void local_search_free(CamelFolder *folder, GPtrArray * result);
static void local_finalize(CamelObject * object);
@@ -80,6 +81,7 @@ camel_local_folder_class_init(CamelLocalFolderClass * camel_local_folder_class)
camel_folder_class->expunge = local_expunge;
camel_folder_class->search_by_expression = local_search_by_expression;
+ camel_folder_class->search_by_uids = local_search_by_uids;
camel_folder_class->search_free = local_search_free;
camel_local_folder_class->lock = local_lock;
@@ -334,6 +336,48 @@ local_search_by_expression(CamelFolder *folder, const char *expression, CamelExc
return matches;
}
+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 */
+
+ summary = g_ptr_array_new();
+ for (i=0;i<uids->len;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;
+
+ CAMEL_LOCAL_FOLDER_LOCK(folder, search_lock);
+
+ if (local_folder->search == NULL)
+ local_folder->search = camel_folder_search_new();
+
+ 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);
+
+ CAMEL_LOCAL_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;
+}
+
static void
local_search_free(CamelFolder *folder, GPtrArray * result)
{