aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorMichael Zucci <zucchi@src.gnome.org>2000-05-02 05:50:46 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-02 05:50:46 +0800
commit896c775a526e35d8c201c5ba4a27d6b87b25167c (patch)
tree6d7ea63d741f4c58b88b4ee0aa451facf9568b35 /camel
parent188a9f0afa2ac898b9bc90c0301c760a7224d100 (diff)
downloadgsoc2013-evolution-896c775a526e35d8c201c5ba4a27d6b87b25167c.tar
gsoc2013-evolution-896c775a526e35d8c201c5ba4a27d6b87b25167c.tar.gz
gsoc2013-evolution-896c775a526e35d8c201c5ba4a27d6b87b25167c.tar.bz2
gsoc2013-evolution-896c775a526e35d8c201c5ba4a27d6b87b25167c.tar.lz
gsoc2013-evolution-896c775a526e35d8c201c5ba4a27d6b87b25167c.tar.xz
gsoc2013-evolution-896c775a526e35d8c201c5ba4a27d6b87b25167c.tar.zst
gsoc2013-evolution-896c775a526e35d8c201c5ba4a27d6b87b25167c.zip
Removed search_id.
* providers/mbox/camel-mbox-folder.h (CamelMboxFolder): Removed search_id. * providers/mbox/camel-mbox-search.c (camel_mbox_folder_search_cancel): Remove.d (camel_mbox_folder_search_complete): Removed. (camel_mbox_folder_search_by_expression): Changed back to sync api. (struct _searchcontext): Removed cancelled flag. (find_context): Removed. * providers/mbox/camel-mbox-search.h (camel_mbox_folder_search_by_expression): Moved back to sync api. (camel_folder_search_complete): Removed. (camel_folder_search_cancel): Removed. (CamelFolderClass): New function summary_get_by_uid() to get a single summary. (*search*): Moved back to synchronous search api ... *sigh* svn path=/trunk/; revision=2723
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog19
-rw-r--r--camel/camel-folder.c53
-rw-r--r--camel/camel-folder.h13
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c14
-rw-r--r--camel/providers/mbox/camel-mbox-folder.h1
-rw-r--r--camel/providers/mbox/camel-mbox-search.c59
-rw-r--r--camel/providers/mbox/camel-mbox-search.h5
7 files changed, 70 insertions, 94 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e3e601cb09..a940175068 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,19 @@
2000-05-01 NotZed <NotZed@HelixCode.com>
+ * providers/mbox/camel-mbox-folder.h (CamelMboxFolder): Removed
+ search_id.
+
+ * providers/mbox/camel-mbox-search.c
+ (camel_mbox_folder_search_cancel): Remove.d
+ (camel_mbox_folder_search_complete): Removed.
+ (camel_mbox_folder_search_by_expression): Changed back to sync
+ api.
+ (struct _searchcontext): Removed cancelled flag.
+ (find_context): Removed.
+
+ * providers/mbox/camel-mbox-search.h
+ (camel_mbox_folder_search_by_expression): Moved back to sync api.
+
* providers/mbox/camel-mbox-summary.c
(camel_mbox_summary_set_flags_by_uid): New function to update the
flags in the summary.
@@ -21,6 +35,8 @@
* camel-folder.c (_finalize): Uh, dont free permanent_flags
anymore (this wouldn't failed anyway, it was a GList !!!)
+ (camel_folder_search_complete): Removed.
+ (camel_folder_search_cancel): Removed.
* camel-folder.h (struct _CamelFolder): Change permanent_flags to
a bitfield.
@@ -29,6 +45,9 @@
(camel_folder_expunge): Changed expunge to a void type. The
messages would no longer be useful after they have been removed
...
+ (CamelFolderClass): New function summary_get_by_uid() to get a single
+ summary.
+ (*search*): Moved back to synchronous search api ... *sigh*
* camel-mime-message.c (set_flag): Removed.
(camel_mime_message_set_flag): Removed.
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index c0d0e5fcb3..446b511221 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -133,6 +133,7 @@ static void _delete_message_by_uid (CamelFolder *folder,
static GPtrArray *get_message_info (CamelFolder *folder, int first, int count);
static GPtrArray *get_subfolder_info (CamelFolder *folder, int first, int count);
+static const CamelMessageInfo *summary_get_by_uid(CamelFolder *f, const char *uid);
static void
@@ -181,6 +182,7 @@ camel_folder_class_init (CamelFolderClass *camel_folder_class)
camel_folder_class->get_subfolder_info = get_subfolder_info;
camel_folder_class->get_message_info = get_message_info;
+ camel_folder_class->summary_get_by_uid = summary_get_by_uid;
/* virtual method overload */
gtk_object_class->finalize = _finalize;
@@ -1246,6 +1248,29 @@ camel_folder_summary_get_message_info (CamelFolder *folder,
return CF_CLASS (folder)->get_message_info (folder, first, count);
}
+static const CamelMessageInfo *
+summary_get_by_uid(CamelFolder *f, const char *uid)
+{
+ g_warning("folder::summary_get_by_uid() unimplemented");
+ return NULL;
+}
+
+/**
+ * camel_folder_summary_get_by_uid:
+ * @folder:
+ * @uid:
+ *
+ * Get a single summary entry, by uid.
+ *
+ * Return value:
+ **/
+const CamelMessageInfo *camel_folder_summary_get_by_uid (CamelFolder *folder, const char *uid)
+{
+ g_assert (folder != NULL);
+ g_assert(uid != NULL);
+ return CF_CLASS (folder)->summary_get_by_uid (folder, uid);
+}
+
/* summary stuff */
/* TODO: is this function required anyway? */
gboolean
@@ -1412,32 +1437,14 @@ camel_folder_has_search_capability (CamelFolder *folder)
return folder->has_search_capability;
}
-int camel_folder_search_by_expression (CamelFolder *folder,
- const char *expression,
- CamelSearchFunc *func,
- void *data,
- CamelException *ex)
-{
- g_assert (folder != NULL);
- g_return_val_if_fail (folder->has_search_capability, -1);
-
- return CF_CLASS (folder)->search_by_expression (folder, expression, func, data, ex);
-}
-
-gboolean camel_folder_search_complete(CamelFolder *folder, int searchid, gboolean wait, CamelException *ex)
-{
- g_assert (folder != NULL);
- g_return_val_if_fail (folder->has_search_capability, FALSE);
-
- return CF_CLASS (folder)->search_complete (folder, searchid, wait, ex);
-}
-
-void camel_folder_search_cancel(CamelFolder *folder, int searchid, CamelException *ex)
+GList *camel_folder_search_by_expression (CamelFolder *folder,
+ const char *expression,
+ CamelException *ex)
{
g_assert (folder != NULL);
- g_return_if_fail (folder->has_search_capability);
+ g_return_val_if_fail (folder->has_search_capability, NULL);
- return CF_CLASS (folder)->search_cancel (folder, searchid, ex);
+ return CF_CLASS (folder)->search_by_expression (folder, expression, ex);
}
/* **** */
diff --git a/camel/camel-folder.h b/camel/camel-folder.h
index 15d8194d2e..b96f3e819c 100644
--- a/camel/camel-folder.h
+++ b/camel/camel-folder.h
@@ -240,15 +240,13 @@ typedef struct {
gboolean (*has_search_capability) (CamelFolder *folder);
- int (*search_by_expression) (CamelFolder *folder, const char *expression,
- CamelSearchFunc *func, void *data, CamelException *ex);
- gboolean (*search_complete)(CamelFolder *folder, int searchid, gboolean wait, CamelException *ex);
- void (*search_cancel) (CamelFolder *folder, int searchid, CamelException *ex);
+ GList * (*search_by_expression) (CamelFolder *folder, const char *expression, CamelException *ex);
/* moved the old summary stuff from camel-folder-summary.h here */
GPtrArray * (*get_subfolder_info) (CamelFolder *, int first, int count);
GPtrArray * (*get_message_info) (CamelFolder *, int first, int count);
+ const CamelMessageInfo * (*summary_get_by_uid) (CamelFolder *, const char *uid);
} CamelFolderClass;
@@ -355,10 +353,7 @@ GList * camel_folder_get_uid_list (CamelFolder *folder,
/* search api */
gboolean camel_folder_has_search_capability (CamelFolder *folder);
-int camel_folder_search_by_expression(CamelFolder *folder, const char *expression,
- CamelSearchFunc *func, void *data, CamelException *ex);
-gboolean camel_folder_search_complete(CamelFolder *folder, int searchid, gboolean wait, CamelException *ex);
-void camel_folder_search_cancel(CamelFolder *folder, int searchid, CamelException *ex);
+GList * camel_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
/* summary info, from the old camel-folder-summary
FIXME: rename these slightly? */
@@ -366,6 +361,8 @@ GPtrArray *camel_folder_summary_get_subfolder_info (CamelFolder *summary,
int first, int count);
GPtrArray *camel_folder_summary_get_message_info (CamelFolder *summary,
int first, int count);
+const CamelMessageInfo *camel_folder_summary_get_by_uid (CamelFolder *summary,
+ const char *uid);
#ifdef __cplusplus
}
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index c6dfb657e7..7e55610cf8 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -81,6 +81,7 @@ static const gchar *_get_message_uid (CamelFolder *folder, CamelMimeMessage *mes
#endif
GPtrArray *summary_get_message_info (CamelFolder *folder, int first, int count);
+static const CamelMessageInfo *mbox_summary_get_by_uid(CamelFolder *f, const char *uid);
static void mbox_finalize (GtkObject *object);
@@ -115,10 +116,9 @@ camel_mbox_folder_class_init (CamelMboxFolderClass *camel_mbox_folder_class)
camel_folder_class->get_message_by_uid = mbox_get_message_by_uid;
camel_folder_class->search_by_expression = camel_mbox_folder_search_by_expression;
- camel_folder_class->search_complete = camel_mbox_folder_search_complete;
- camel_folder_class->search_cancel = camel_mbox_folder_search_cancel;
camel_folder_class->get_message_info = summary_get_message_info;
+ camel_folder_class->summary_get_by_uid = mbox_summary_get_by_uid;
gtk_object_class->finalize = mbox_finalize;
@@ -933,3 +933,13 @@ GPtrArray *summary_get_message_info (CamelFolder *folder, int first, int count)
return array;
}
+
+/* get a single message info, by uid */
+static const CamelMessageInfo *
+mbox_summary_get_by_uid(CamelFolder *f, const char *uid)
+{
+ CamelMboxFolder *mbox_folder = (CamelMboxFolder *)f;
+
+ return (CamelMessageInfo *)camel_mbox_summary_uid(mbox_folder->summary, uid);
+}
+
diff --git a/camel/providers/mbox/camel-mbox-folder.h b/camel/providers/mbox/camel-mbox-folder.h
index f74c51a6c3..366aca3e86 100644
--- a/camel/providers/mbox/camel-mbox-folder.h
+++ b/camel/providers/mbox/camel-mbox-folder.h
@@ -54,7 +54,6 @@ typedef struct {
gchar *index_file_path; /* index of body contents */
ibex *index; /* index for this folder */
- int search_id; /* next search id */
GList *searches; /* current searches */
CamelMboxSummary *summary;
diff --git a/camel/providers/mbox/camel-mbox-search.c b/camel/providers/mbox/camel-mbox-search.c
index 1e134476e5..094533edbd 100644
--- a/camel/providers/mbox/camel-mbox-search.c
+++ b/camel/providers/mbox/camel-mbox-search.c
@@ -76,7 +76,6 @@
struct _searchcontext {
int id; /* id of this search */
- int cancelled; /* search cancelled? */
CamelFolder *folder;
@@ -268,8 +267,7 @@ static struct {
{ "header-contains", func_header_contains, 0 },
};
-int camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression,
- CamelSearchFunc *func, void *data, CamelException *ex)
+GList *camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex)
{
int i;
struct _searchcontext *ctx;
@@ -283,8 +281,6 @@ int camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expr
ctx = g_malloc0(sizeof(*ctx));
- ctx->id = ((CamelMboxFolder *)folder)->search_id++;
-
/* setup out context */
ctx->folder = folder;
ctx->summary = mbox_folder->summary;
@@ -294,7 +290,7 @@ int camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expr
"Full description : %s\n", camel_exception_get_description (ex));
g_free(ctx);
gtk_object_unref((GtkObject *)f);
- return -1;
+ return NULL;
}
/* FIXME: the index should be global to the folder */
@@ -326,67 +322,18 @@ int camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expr
d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
matches = g_list_prepend(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i)));
}
- if (!ctx->cancelled) {
- func(folder, ctx->id, TRUE, matches, data);
- }
- g_list_free(matches);
e_sexp_result_free(r);
} else {
printf("no result!\n");
}
gtk_object_unref((GtkObject *)f);
- i = ctx->id;
((CamelMboxFolder *)folder)->searches = g_list_remove(((CamelMboxFolder *)folder)->searches, ctx);
g_free(ctx);
- return i;
-}
-
-static struct _searchcontext *
-find_context(CamelMboxFolder *f, int id)
-{
- struct _searchcontext *ctx;
- GList *l;
-
- l = f->searches;
- while (l) {
- ctx = l->data;
- if (ctx->id == id) {
- return ctx;
- }
- l = g_list_next(l);
- }
-
- return NULL;
-}
-
-gboolean camel_mbox_folder_search_complete(CamelFolder *folder, int searchid, int wait, CamelException *ex)
-{
- struct _searchcontext *ctx;
-
- ctx = find_context((CamelMboxFolder *)folder, searchid);
-
- if (ctx)
- return ctx->cancelled;
-
- /* if its been removed, its complete ... */
- return TRUE;
-}
-
-void camel_mbox_folder_search_cancel(CamelFolder *folder, int searchid, CamelException *ex)
-{
- struct _searchcontext *ctx;
-
- ctx = find_context((CamelMboxFolder *)folder, searchid);
- if (ctx) {
- ctx->cancelled = TRUE;
- return;
- }
-
- /* FIXME: set exception, return */
+ return matches;
}
#else /* HAVE_FILTER */
diff --git a/camel/providers/mbox/camel-mbox-search.h b/camel/providers/mbox/camel-mbox-search.h
index d3fe328a2c..f99d922252 100644
--- a/camel/providers/mbox/camel-mbox-search.h
+++ b/camel/providers/mbox/camel-mbox-search.h
@@ -5,10 +5,7 @@
#include <glib.h>
#include "camel-mbox-folder.h"
-int camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression,
- CamelSearchFunc *func, void *data, CamelException *ex);
-gboolean camel_mbox_folder_search_complete(CamelFolder *folder, int searchid, gboolean wait, CamelException *ex);
-void camel_mbox_folder_search_cancel(CamelFolder *folder, int searchid, CamelException *ex);
+GList *camel_mbox_folder_search_by_expression(CamelFolder *folder, const char *expression, CamelException *ex);
#endif /* ! _CAMEL_MBOX_SEARCH_H */