aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNotZed <NotZed@HelixCode.com>2000-05-19 06:40:24 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-19 06:40:24 +0800
commit1ff07425c1e2963f7fe835ac4be2c725f12827f5 (patch)
treee0da79df08b334a0ee0ccdcd7e1d52fb2397a3d0 /camel
parent8eb6a561ab9013d3ad12599176c077c57f12ce08 (diff)
downloadgsoc2013-evolution-1ff07425c1e2963f7fe835ac4be2c725f12827f5.tar
gsoc2013-evolution-1ff07425c1e2963f7fe835ac4be2c725f12827f5.tar.gz
gsoc2013-evolution-1ff07425c1e2963f7fe835ac4be2c725f12827f5.tar.bz2
gsoc2013-evolution-1ff07425c1e2963f7fe835ac4be2c725f12827f5.tar.lz
gsoc2013-evolution-1ff07425c1e2963f7fe835ac4be2c725f12827f5.tar.xz
gsoc2013-evolution-1ff07425c1e2963f7fe835ac4be2c725f12827f5.tar.zst
gsoc2013-evolution-1ff07425c1e2963f7fe835ac4be2c725f12827f5.zip
Guess!
2000-05-18 NotZed <NotZed@HelixCode.com> * providers/vee/camel-vee-folder.c: Guess! * camel-folder-search.c (search_user_flag): Implement user_flag search term. * camel-folder-search.h: Added user_flag search capability (user-flag "blah") * providers/mbox/camel-mbox-folder.c (mbox_init): Set USER flag in permanent flags for the folder. svn path=/trunk/; revision=3122
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog13
-rw-r--r--camel/camel-folder-search.c31
-rw-r--r--camel/camel-folder-search.h3
-rw-r--r--camel/camel-folder-summary.c4
-rw-r--r--camel/providers/Makefile.am2
-rw-r--r--camel/providers/mbox/camel-mbox-folder.c3
-rw-r--r--camel/providers/vee/Makefile.am39
-rw-r--r--camel/providers/vee/camel-vee-folder.c336
-rw-r--r--camel/providers/vee/camel-vee-folder.h56
-rw-r--r--camel/providers/vee/camel-vee-provider.c45
-rw-r--r--camel/providers/vee/camel-vee-store.c132
-rw-r--r--camel/providers/vee/camel-vee-store.h48
12 files changed, 709 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 9c40ae1392..1b7d5734c3 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,16 @@
+2000-05-18 NotZed <NotZed@HelixCode.com>
+
+ * providers/vee/camel-vee-folder.c: Guess!
+
+ * camel-folder-search.c (search_user_flag): Implement user_flag
+ search term.
+
+ * camel-folder-search.h: Added user_flag search capability
+ (user-flag "blah")
+
+ * providers/mbox/camel-mbox-folder.c (mbox_init): Set USER flag in
+ permanent flags for the folder.
+
2000-05-17 Dan Winship <danw@helixcode.com>
* camel-folder.c: Remove unused async open/close and
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index e5110d1d1a..b6332c5656 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -40,6 +40,7 @@ struct _CamelFolderSearchPrivate {
static ESExpResult *search_header_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
static ESExpResult *search_match_all(struct _ESExp *f, int argc, struct _ESExpTerm **argv, CamelFolderSearch *search);
static ESExpResult *search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
+static ESExpResult *search_user_flag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
static ESExpResult *search_dummy(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search);
@@ -89,6 +90,7 @@ camel_folder_search_class_init (CamelFolderSearchClass *klass)
klass->match_all = search_match_all;
klass->body_contains = search_body_contains;
klass->header_contains = search_header_contains;
+ klass->user_flag = search_user_flag;
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
@@ -133,6 +135,7 @@ struct {
{ "match-all", GTK_STRUCT_OFFSET(CamelFolderSearchClass, match_all), 3 },
{ "body-contains", GTK_STRUCT_OFFSET(CamelFolderSearchClass, body_contains), 1 },
{ "header-contains", GTK_STRUCT_OFFSET(CamelFolderSearchClass, header_contains), 1 },
+ { "user-flag", GTK_STRUCT_OFFSET(CamelFolderSearchClass, user_flag), 1 },
};
void
@@ -463,3 +466,31 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam
return r;
}
+
+static ESExpResult *search_user_flag(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
+{
+ ESExpResult *r;
+ int i;
+
+ r(printf("executing header-contains\n"));
+
+ /* are we inside a match-all? */
+ if (search->current) {
+ int truth = FALSE;
+ /* performs an OR of all words */
+ for (i=0;i<argc && !truth;i++) {
+ if (argv[i]->type == ESEXP_RES_STRING
+ && camel_flag_get(&search->current->user_flags, argv[i]->value.string)) {
+ truth = TRUE;
+ break;
+ }
+ }
+ r = e_sexp_result_new(ESEXP_RES_BOOL);
+ r->value.bool = truth;
+ } else {
+ r = e_sexp_result_new(ESEXP_RES_ARRAY_PTR);
+ r->value.ptrarray = g_ptr_array_new();
+ }
+
+ return r;
+}
diff --git a/camel/camel-folder-search.h b/camel/camel-folder-search.h
index 26fdb2ecc3..87493912f8 100644
--- a/camel/camel-folder-search.h
+++ b/camel/camel-folder-search.h
@@ -68,6 +68,9 @@ struct _CamelFolderSearchClass {
/* (header-contains "headername" "string1" ...) List of matches, or true if in single-message mode */
ESExpResult * (*header_contains)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
+
+ /* (user-flag "flagname" "flagname" ...) If one of user-flag set */
+ ESExpResult * (*user_flag)(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *s);
};
guint camel_folder_search_get_type (void);
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 11f4841480..9e3b478236 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -28,6 +28,8 @@
#include "camel-folder-summary.h"
+#include <camel/camel-mime-message.h>
+
#include <camel/camel-mime-filter.h>
#include <camel/camel-mime-filter-index.h>
#include <camel/camel-mime-filter-charset.h>
@@ -1008,7 +1010,6 @@ static int
message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
{
guint32 count;
- int i;
CamelFlag *flag;
io(printf("Saving message info\n"));
@@ -1029,6 +1030,7 @@ message_info_save(CamelFolderSummary *s, FILE *out, CamelMessageInfo *mi)
camel_folder_summary_encode_string(out, flag->name);
flag = flag->next;
}
+ return ferror(out);
}
static void
diff --git a/camel/providers/Makefile.am b/camel/providers/Makefile.am
index a1af905e6b..c3829d39b2 100644
--- a/camel/providers/Makefile.am
+++ b/camel/providers/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = mbox pop3 sendmail
+SUBDIRS = mbox pop3 sendmail vee
# these ones are disabled for the moment.
# MH maildir nntp smtp
diff --git a/camel/providers/mbox/camel-mbox-folder.c b/camel/providers/mbox/camel-mbox-folder.c
index 460b970ca7..a67d2ee67e 100644
--- a/camel/providers/mbox/camel-mbox-folder.c
+++ b/camel/providers/mbox/camel-mbox-folder.c
@@ -186,7 +186,8 @@ mbox_init (CamelFolder *folder, CamelStore *parent_store,
CAMEL_MESSAGE_DELETED |
CAMEL_MESSAGE_DRAFT |
CAMEL_MESSAGE_FLAGGED |
- CAMEL_MESSAGE_SEEN;
+ CAMEL_MESSAGE_SEEN |
+ CAMEL_MESSAGE_USER;
mbox_folder->summary = NULL;
mbox_folder->search = NULL;
diff --git a/camel/providers/vee/Makefile.am b/camel/providers/vee/Makefile.am
new file mode 100644
index 0000000000..601defcb80
--- /dev/null
+++ b/camel/providers/vee/Makefile.am
@@ -0,0 +1,39 @@
+## Process this file with automake to produce Makefile.in
+
+SUBDIRS =
+
+libcamelveeincludedir = $(includedir)/camel
+
+
+providerdir = $(pkglibdir)/camel-providers/$(VERSION)
+
+provider_LTLIBRARIES = libcamelvee.la
+provider_DATA = libcamelvee.urls
+
+INCLUDES = -I.. \
+ -I$(srcdir)/.. \
+ -I$(top_srcdir)/camel \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/libibex \
+ -I$(top_srcdir)/e-util \
+ -I$(top_srcdir) \
+ -I$(includedir) \
+ $(GTK_INCLUDEDIR) \
+ -DG_LOG_DOMAIN=\"camel-vee-provider\"
+
+libcamelvee_la_SOURCES = \
+ camel-vee-folder.c \
+ camel-vee-provider.c \
+ camel-vee-store.c
+
+libcamelveeinclude_HEADERS = \
+ camel-vee-folder.h \
+ camel-vee-store.h
+
+libcamelvee_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
+
+libcamelvee_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
+#libcamelvee_la_LIBADD = $(top_builddir)/libibex/libibex.la $(UNICODE_LIBS)
+
+EXTRA_DIST = libcamelvee.urls
+
diff --git a/camel/providers/vee/camel-vee-folder.c b/camel/providers/vee/camel-vee-folder.c
new file mode 100644
index 0000000000..d759fd30eb
--- /dev/null
+++ b/camel/providers/vee/camel-vee-folder.c
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 2000 Helix Code Inc.
+ *
+ * Authors: Michael Zucchi <notzed@helixcode.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "camel-exception.h"
+#include "camel-vee-folder.h"
+#include "camel-folder-summary.h"
+#include "camel-mime-message.h"
+
+#include <string.h>
+
+/* our message info includes the parent folder */
+typedef struct _CamelVeeMessageInfo {
+ CamelMessageInfo info;
+ CamelFolder *folder;
+} CamelVeeMessageInfo;
+
+struct _CamelVeeFolderPrivate {
+ GList *folders;
+};
+
+#define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv)
+
+static void vee_init (CamelFolder *folder, CamelStore *parent_store,
+ CamelFolder *parent_folder, const gchar *name,
+ gchar separator, CamelException *ex);
+
+static void vee_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex);
+static void vee_close (CamelFolder *folder, gboolean expunge, CamelException *ex);
+static gboolean vee_exists (CamelFolder *folder, CamelException *ex);
+
+static GList *vee_get_uid_list (CamelFolder *folder, CamelException *ex);
+
+static gint vee_get_message_count (CamelFolder *folder, CamelException *ex);
+static CamelMimeMessage *vee_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex);
+
+GPtrArray *vee_summary_get_message_info (CamelFolder *folder, int first, int count);
+static const CamelMessageInfo *vee_summary_get_by_uid(CamelFolder *f, const char *uid);
+
+
+static void camel_vee_folder_class_init (CamelVeeFolderClass *klass);
+static void camel_vee_folder_init (CamelVeeFolder *obj);
+static void camel_vee_folder_finalise (GtkObject *obj);
+
+static void vee_folder_build(CamelVeeFolder *vf, CamelException *ex);
+
+static CamelFolderClass *camel_vee_folder_parent;
+
+enum SIGNALS {
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+guint
+camel_vee_folder_get_type (void)
+{
+ static guint type = 0;
+
+ if (!type) {
+ GtkTypeInfo type_info = {
+ "CamelVeeFolder",
+ sizeof (CamelVeeFolder),
+ sizeof (CamelVeeFolderClass),
+ (GtkClassInitFunc) camel_vee_folder_class_init,
+ (GtkObjectInitFunc) camel_vee_folder_init,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
+ };
+
+ type = gtk_type_unique (camel_folder_get_type (), &type_info);
+ }
+
+ return type;
+}
+
+static void
+camel_vee_folder_class_init (CamelVeeFolderClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ CamelFolderClass *folder_class = (CamelFolderClass *) klass;
+
+ camel_vee_folder_parent = gtk_type_class (camel_folder_get_type ());
+
+ printf("vfolder class init\n");
+
+ folder_class->init = vee_init;
+ folder_class->open = vee_open;
+ folder_class->close = vee_close;
+ folder_class->exists = vee_exists;
+
+ folder_class->get_uid_list = vee_get_uid_list;
+ folder_class->get_message_by_uid = vee_get_message_by_uid;
+
+ folder_class->get_message_info = vee_summary_get_message_info;
+ folder_class->summary_get_by_uid = vee_summary_get_by_uid;
+
+ folder_class->get_message_count = vee_get_message_count;
+
+ object_class->finalize = camel_vee_folder_finalise;
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+}
+
+static void
+camel_vee_folder_init (CamelVeeFolder *obj)
+{
+ struct _CamelVeeFolderPrivate *p;
+
+ printf("vfolder init\n");
+
+ p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
+}
+
+static void
+camel_vee_folder_finalise (GtkObject *obj)
+{
+ ((GtkObjectClass *)(camel_vee_folder_parent))->finalize((GtkObject *)obj);
+}
+
+/**
+ * camel_vee_folder_new:
+ *
+ * Create a new CamelVeeFolder object.
+ *
+ * Return value: A new CamelVeeFolder widget.
+ **/
+CamelVeeFolder *
+camel_vee_folder_new (void)
+{
+ CamelVeeFolder *new = CAMEL_VEE_FOLDER ( gtk_type_new (camel_vee_folder_get_type ()));
+ return new;
+}
+
+
+static void vee_init (CamelFolder *folder, CamelStore *parent_store,
+ CamelFolder *parent_folder, const gchar *name,
+ gchar separator, CamelException *ex)
+{
+ CamelVeeFolder *vf = (CamelVeeFolder *)folder;
+
+ camel_vee_folder_parent->init (folder, parent_store, parent_folder, name, separator, ex);
+ if (camel_exception_get_id (ex))
+ return;
+
+ folder->can_hold_messages = TRUE;
+ folder->can_hold_folders = FALSE;
+ folder->has_summary_capability = TRUE;
+ folder->has_uid_capability = TRUE;
+ folder->has_search_capability = TRUE;
+
+ /* FIXME: what to do about user flags if the subfolder doesn't support them? */
+ folder->permanent_flags = CAMEL_MESSAGE_ANSWERED |
+ CAMEL_MESSAGE_DELETED |
+ CAMEL_MESSAGE_DRAFT |
+ CAMEL_MESSAGE_FLAGGED |
+ CAMEL_MESSAGE_SEEN;
+
+ vf->messages = g_ptr_array_new();
+ vf->messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
+
+ vf->expression = g_strdup(folder->name);
+}
+
+static void vee_open (CamelFolder *folder, CamelFolderOpenMode mode, CamelException *ex)
+{
+ CamelVeeFolder *vf = (CamelVeeFolder *)folder;
+
+ camel_vee_folder_parent->open (folder, mode, ex);
+ if (camel_exception_get_id(ex))
+ return;
+
+ /* perform search on folders to be searched ... */
+ vee_folder_build(vf, ex);
+}
+
+static void vee_close (CamelFolder *folder, gboolean expunge, CamelException *ex)
+{
+ camel_vee_folder_parent->close (folder, expunge, ex);
+
+ /* FIXME: close vfolder? */
+}
+
+/* vfolders always exist? */
+static gboolean vee_exists (CamelFolder *folder, CamelException *ex)
+{
+ return TRUE;
+}
+
+static gint vee_get_message_count (CamelFolder *folder, CamelException *ex)
+{
+ CamelVeeFolder *vf = (CamelVeeFolder *)folder;
+
+ return vf->messages->len;
+}
+
+static CamelMimeMessage *vee_get_message_by_uid (CamelFolder *folder, const gchar *uid, CamelException *ex)
+{
+ CamelVeeMessageInfo *mi;
+
+ mi = (CamelVeeMessageInfo *)vee_summary_get_by_uid(folder, uid);
+ if (mi == NULL) {
+ camel_exception_setv(ex, 1, "Failed");
+ return NULL;
+ }
+ return camel_folder_get_message_by_uid(mi->folder, strchr(mi->info.uid, ':')+1, ex);
+}
+
+GPtrArray *vee_summary_get_message_info (CamelFolder *folder, int first, int count)
+{
+ GPtrArray *result;
+ int i, max;
+ CamelVeeFolder *vf = (CamelVeeFolder *)folder;
+
+ result = g_ptr_array_new();
+ max = MIN(vf->messages->len, count+first);
+ for (i=first;i<max;i++) {
+ g_ptr_array_add(result, g_ptr_array_index(vf->messages, i));
+ }
+ return result;
+}
+
+static const CamelMessageInfo *vee_summary_get_by_uid(CamelFolder *f, const char *uid)
+{
+ CamelVeeFolder *vf = (CamelVeeFolder *)f;
+
+ return g_hash_table_lookup(vf->messages_uid, uid);
+}
+
+static GList *vee_get_uid_list (CamelFolder *folder, CamelException *ex)
+{
+ GList *result = NULL;
+ int i;
+ CamelVeeFolder *vf = (CamelVeeFolder *)folder;
+
+ for (i=0;i<vf->messages->len;i++) {
+ CamelMessageInfo *mi = g_ptr_array_index(vf->messages, i);
+ result = g_list_prepend(result, g_strdup(mi->uid));
+ }
+
+ return result;
+}
+
+void
+camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
+{
+ struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
+
+ gtk_object_ref((GtkObject *)sub);
+ p->folders = g_list_append(p->folders, sub);
+}
+
+/*
+ need incremental update, based on folder.
+ Need to watch folders for changes and update accordingly.
+*/
+
+/* this does most of the vfolder magic */
+static void
+vee_folder_build(CamelVeeFolder *vf, CamelException *ex)
+{
+ struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
+ GList *node;
+
+ GPtrArray *messages;
+ GHashTable *messages_uid;
+
+ messages = g_ptr_array_new();
+ messages_uid = g_hash_table_new(g_str_hash, g_str_equal);
+
+ node = p->folders;
+ while (node) {
+ GList *matches, *match;
+ CamelFolder *f = node->data;
+ CamelVeeMessageInfo *mi;
+ const CamelMessageInfo *info;
+ CamelFlag *flag;
+
+ matches = camel_folder_search_by_expression(f, vf->expression, ex);
+ match = matches;
+ while (match) {
+ info = camel_folder_summary_get_by_uid(f, match->data);
+ if (info) {
+ mi = g_malloc0(sizeof(*mi));
+ mi->info.subject = g_strdup(info->subject);
+ mi->info.to = g_strdup(info->to);
+ mi->info.from = g_strdup(info->from);
+ mi->info.uid = g_strdup_printf("%p:%s", f, info->uid);
+ mi->info.flags = info->flags;
+ mi->info.size = info->size;
+ mi->info.date_sent = info->date_sent;
+ mi->info.date_received = info->date_received;
+ flag = info->user_flags;
+ while (flag) {
+ camel_flag_set(&mi->info.user_flags, flag->name, TRUE);
+ flag = flag->next;
+ }
+ mi->info.content = NULL;
+ mi->folder = f;
+ g_ptr_array_add(messages, mi);
+ g_hash_table_insert(messages_uid, mi->info.uid, mi);
+ }
+ match = g_list_next(match);
+ }
+ g_list_free(matches);
+ node = g_list_next(node);
+ }
+
+#warning "free messages on query update"
+ vf->messages = messages;
+ vf->messages_uid = messages_uid;
+}
+
+
+/*
+
+ (match-folder "folder1" "folder2")
+
+ */
diff --git a/camel/providers/vee/camel-vee-folder.h b/camel/providers/vee/camel-vee-folder.h
new file mode 100644
index 0000000000..4d82c842ea
--- /dev/null
+++ b/camel/providers/vee/camel-vee-folder.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2000 Helix Code Inc.
+ *
+ * Authors: Michael Zucchi <notzed@helixcode.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef _CAMEL_VEE_FOLDER_H
+#define _CAMEL_VEE_FOLDER_H
+
+#include <gtk/gtk.h>
+#include <camel/camel-folder.h>
+
+#define CAMEL_VEE_FOLDER(obj) GTK_CHECK_CAST (obj, camel_vee_folder_get_type (), CamelVeeFolder)
+#define CAMEL_VEE_FOLDER_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_vee_folder_get_type (), CamelVeeFolderClass)
+#define IS_CAMEL_VEE_FOLDER(obj) GTK_CHECK_TYPE (obj, camel_vee_folder_get_type ())
+
+typedef struct _CamelVeeFolder CamelVeeFolder;
+typedef struct _CamelVeeFolderClass CamelVeeFolderClass;
+
+struct _CamelVeeFolder {
+ CamelFolder parent;
+
+ struct _CamelVeeFolderPrivate *priv;
+
+ char *expression; /* query expression */
+
+ /* FIXME: Move this to a summary object??? */
+ GPtrArray *messages; /* message info's */
+ GHashTable *messages_uid;
+};
+
+struct _CamelVeeFolderClass {
+ CamelFolderClass parent_class;
+};
+
+guint camel_vee_folder_get_type (void);
+CamelVeeFolder *camel_vee_folder_new (void);
+
+void camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub);
+
+#endif /* ! _CAMEL_VEE_FOLDER_H */
diff --git a/camel/providers/vee/camel-vee-provider.c b/camel/providers/vee/camel-vee-provider.c
new file mode 100644
index 0000000000..b9c20b4561
--- /dev/null
+++ b/camel/providers/vee/camel-vee-provider.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2000 Helix Code Inc.
+ *
+ * Authors: Michael Zucchi <notzed@helixcode.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "config.h"
+#include "camel-vee-store.h"
+#include "camel-provider.h"
+#include "camel-session.h"
+
+static CamelProvider vee_provider = {
+ "vfolder",
+ "Virtual folder email provider",
+
+ "For reading mail as a query of another set of folders",
+
+ 0,
+
+ { 0, 0 }
+};
+
+void
+camel_provider_module_init (CamelSession *session)
+{
+ vee_provider.object_types[CAMEL_PROVIDER_STORE] =
+ camel_vee_store_get_type();
+
+ camel_session_register_provider (session, &vee_provider);
+}
diff --git a/camel/providers/vee/camel-vee-store.c b/camel/providers/vee/camel-vee-store.c
new file mode 100644
index 0000000000..b62a6b9fab
--- /dev/null
+++ b/camel/providers/vee/camel-vee-store.c
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2000 Helix Code Inc.
+ *
+ * Authors: Michael Zucchi <notzed@helixcode.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#include "camel-vee-store.h"
+#include "camel-vee-folder.h"
+
+static CamelFolder *vee_get_folder (CamelStore *store, const char *folder_name, CamelException *ex);
+static char *vee_get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex);
+
+struct _CamelVeeStorePrivate {
+};
+
+#define _PRIVATE(o) (((CamelVeeStore *)(o))->priv)
+
+static void camel_vee_store_class_init (CamelVeeStoreClass *klass);
+static void camel_vee_store_init (CamelVeeStore *obj);
+static void camel_vee_store_finalise (GtkObject *obj);
+
+static CamelStoreClass *camel_vee_store_parent;
+
+enum SIGNALS {
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+guint
+camel_vee_store_get_type (void)
+{
+ static guint type = 0;
+
+ if (!type) {
+ GtkTypeInfo type_info = {
+ "CamelVeeStore",
+ sizeof (CamelVeeStore),
+ sizeof (CamelVeeStoreClass),
+ (GtkClassInitFunc) camel_vee_store_class_init,
+ (GtkObjectInitFunc) camel_vee_store_init,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
+ };
+
+ type = gtk_type_unique (camel_store_get_type (), &type_info);
+ }
+
+ return type;
+}
+
+static void
+
+camel_vee_store_class_init (CamelVeeStoreClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ CamelStoreClass *store_class = (CamelStoreClass *) klass;
+
+ camel_vee_store_parent = gtk_type_class (camel_store_get_type ());
+
+ /* virtual method overload */
+ store_class->get_folder = vee_get_folder;
+ store_class->get_folder_name = vee_get_folder_name;
+
+ object_class->finalize = camel_vee_store_finalise;
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+}
+
+static void
+camel_vee_store_init (CamelVeeStore *obj)
+{
+ struct _CamelVeeStorePrivate *p;
+
+ p = _PRIVATE(obj) = g_malloc0(sizeof(*p));
+}
+
+static void
+camel_vee_store_finalise (GtkObject *obj)
+{
+ ((GtkObjectClass *)(camel_vee_store_parent))->finalize((GtkObject *)obj);
+}
+
+/**
+ * camel_vee_store_new:
+ *
+ * Create a new CamelVeeStore object.
+ *
+ * Return value: A new CamelVeeStore widget.
+ **/
+CamelVeeStore *
+camel_vee_store_new (void)
+{
+ CamelVeeStore *new = CAMEL_VEE_STORE ( gtk_type_new (camel_vee_store_get_type ()));
+ return new;
+}
+
+static CamelFolder *
+vee_get_folder (CamelStore *store, const char *folder_name, CamelException *ex)
+{
+ CamelFolder *folder;
+
+ folder = gtk_type_new (camel_vee_folder_get_type());
+
+ printf("my type is: %s\n", gtk_type_name(((GtkObject *)folder)->klass->type));
+
+ ((CamelFolderClass *)((GtkObject *)folder)->klass)->init (folder, store, NULL, folder_name, '/', ex);
+ return folder;
+}
+
+static char *
+vee_get_folder_name (CamelStore *store, const char *folder_name, CamelException *ex)
+{
+#warning "What purpose does this function serve?"
+ return g_strdup(folder_name);
+}
+
diff --git a/camel/providers/vee/camel-vee-store.h b/camel/providers/vee/camel-vee-store.h
new file mode 100644
index 0000000000..848769296a
--- /dev/null
+++ b/camel/providers/vee/camel-vee-store.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2000 Helix Code Inc.
+ *
+ * Authors: Michael Zucchi <notzed@helixcode.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
+#ifndef _CAMEL_VEE_STORE_H
+#define _CAMEL_VEE_STORE_H
+
+#include <gtk/gtk.h>
+#include <camel/camel-store.h>
+
+#define CAMEL_VEE_STORE(obj) GTK_CHECK_CAST (obj, camel_vee_store_get_type (), CamelVeeStore)
+#define CAMEL_VEE_STORE_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_vee_store_get_type (), CamelVeeStoreClass)
+#define IS_CAMEL_VEE_STORE(obj) GTK_CHECK_TYPE (obj, camel_vee_store_get_type ())
+
+typedef struct _CamelVeeStore CamelVeeStore;
+typedef struct _CamelVeeStoreClass CamelVeeStoreClass;
+
+struct _CamelVeeStore {
+ CamelStore parent;
+
+ struct _CamelVeeStorePrivate *priv;
+};
+
+struct _CamelVeeStoreClass {
+ CamelStoreClass parent_class;
+};
+
+guint camel_vee_store_get_type (void);
+CamelVeeStore *camel_vee_store_new (void);
+
+#endif /* ! _CAMEL_VEE_STORE_H */