aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder.c
diff options
context:
space:
mode:
author9 <NotZed@Ximian.com>2001-10-10 06:26:01 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-10 06:26:01 +0800
commitd5e090651bbd30ee761624187db6ad7920162aa8 (patch)
tree7ad7107b56496575d6e9914723ff8670a74e7351 /camel/camel-folder.c
parent7980990c79feaa36f452d9e2f2f59e8de1b1ec5c (diff)
downloadgsoc2013-evolution-d5e090651bbd30ee761624187db6ad7920162aa8.tar.gz
gsoc2013-evolution-d5e090651bbd30ee761624187db6ad7920162aa8.tar.zst
gsoc2013-evolution-d5e090651bbd30ee761624187db6ad7920162aa8.zip
Implement.
2001-10-09 <NotZed@Ximian.com> * providers/local/camel-spool-folder.c (spool_search_by_uids): Implement. * providers/imap/camel-imap-search.c (imap_body_contains): If searching a sub-set of the total message count, then use a UID range to search only specific messages. * camel-vee-folder.c (vee_folder_change_match): Removed. (folder_changed_add_uid): Helper func for changed code. (folder_changed_remove_uid): " (folder_changed_change_uid): " (folder_changed): Rewritten. Supports proper auto-updating of changes, but not removals till a sync occurs. (vee_search_by_uids): Implement. (folder_changed): Changed to call an async threaded function to do the actual folder updating. * camel-folder-summary.c (camel_flag_list_copy): New func to copy a whole list of flags. (camel_tag_list_copy): New func to copy a whole list of flags. * providers/imap/camel-imap-folder.c (imap_search_by_uids): Implement. * providers/local/camel-local-folder.c (local_search_by_uids): Implement. * camel-folder.c (camel_folder_search_by_uids): New function, search a subset of uid's. (search_by_uids): Default impl, return error. svn path=/trunk/; revision=13532
Diffstat (limited to 'camel/camel-folder.c')
-rw-r--r--camel/camel-folder.c50
1 files changed, 44 insertions, 6 deletions
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index b8868197b1..e5ae0ba2e5 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -46,7 +46,7 @@
static CamelObjectClass *parent_class = NULL;
/* Returns the class for a CamelFolder */
-#define CF_CLASS(so) CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(so))
+#define CF_CLASS(so) ((CamelFolderClass *)((CamelObject *)(so))->classfuncs)
static void camel_folder_finalize (CamelObject *object);
@@ -95,11 +95,9 @@ static CamelMessageInfo *get_message_info (CamelFolder *folder, const char *uid)
static void free_message_info (CamelFolder *folder, CamelMessageInfo *info);
static void ref_message_info (CamelFolder *folder, CamelMessageInfo *info);
-static GPtrArray *search_by_expression (CamelFolder *folder,
- const char *exp,
- CamelException *ex);
-static void search_free (CamelFolder * folder,
- GPtrArray * result);
+static GPtrArray *search_by_expression (CamelFolder *folder, const char *exp, CamelException *ex);
+static GPtrArray *search_by_uids (CamelFolder *folder, const char *exp, GPtrArray *uids, CamelException *ex);
+static void search_free (CamelFolder * folder, GPtrArray *result);
static void copy_messages_to (CamelFolder *source,
GPtrArray *uids,
@@ -153,6 +151,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
camel_folder_class->get_summary = get_summary;
camel_folder_class->free_summary = free_summary;
camel_folder_class->search_by_expression = search_by_expression;
+ camel_folder_class->search_by_uids = search_by_uids;
camel_folder_class->search_free = search_free;
camel_folder_class->get_message_info = get_message_info;
camel_folder_class->ref_message_info = ref_message_info;
@@ -1081,6 +1080,45 @@ camel_folder_search_by_expression (CamelFolder *folder, const char *expression,
return ret;
}
+static GPtrArray *
+search_by_uids(CamelFolder *folder, const char *exp, GPtrArray *uids, CamelException *ex)
+{
+ camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
+ _("Unsupported operation: search by uids: for %s"),
+ camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder)));
+
+ w(g_warning ("CamelFolder::search_by_expression not implemented for "
+ "`%s'", camel_type_to_name (CAMEL_OBJECT_GET_TYPE (folder))));
+
+ return NULL;
+}
+
+/**
+ * camel_folder_search_by_uids:
+ * @folder:
+ * @expr:
+ * @uids: array of uid's to match against.
+ * @ex:
+ *
+ * Search a subset of uid's for an expression match.
+ *
+ * Return value:
+ **/
+GPtrArray *
+camel_folder_search_by_uids(CamelFolder *folder, const char *expr, GPtrArray *uids, CamelException *ex)
+{
+ GPtrArray *ret;
+
+ g_return_val_if_fail(CAMEL_IS_FOLDER (folder), NULL);
+ g_return_val_if_fail(folder->folder_flags & CAMEL_FOLDER_HAS_SEARCH_CAPABILITY, NULL);
+
+ /* NOTE: that it is upto the callee to lock */
+
+ ret = CF_CLASS(folder)->search_by_uids(folder, expr, uids, ex);
+
+ return ret;
+}
+
static void
search_free (CamelFolder *folder, GPtrArray *result)
{