aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-store-summary.h
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2002-01-14 17:35:52 +0800
committerMichael Zucci <zucchi@src.gnome.org>2002-01-14 17:35:52 +0800
commit345d090ac854ad26d2a19827d56f3d48382a1256 (patch)
tree43aed744bd98d91bfb0586e129094e4b1f263a0b /camel/camel-store-summary.h
parent7ace2ffaad1c6be679d29d5240512ceff35ea4a1 (diff)
downloadgsoc2013-evolution-345d090ac854ad26d2a19827d56f3d48382a1256.tar.gz
gsoc2013-evolution-345d090ac854ad26d2a19827d56f3d48382a1256.tar.zst
gsoc2013-evolution-345d090ac854ad26d2a19827d56f3d48382a1256.zip
Rewritten to use a cache for body searches when online. Will need some
2002-01-14 Not Zed <NotZed@Ximian.com> * providers/imap/camel-imap-search.c (imap_body_contains): Rewritten to use a cache for body searches when online. Will need some heavy testing but so far seems to be beneficial. * providers/imap/camel-imap-folder.c (imap_search_by_expression, search_by_uids): dont initialise search object here. (camel_imap_folder_new): Setup search object here with pointer to cache dir. 2001-12-01 Not Zed <NotZed@Ximian.com> * camel-store-summary.[ch]: New class to store a store's folder list in. Not yet completed. svn path=/trunk/; revision=15314
Diffstat (limited to 'camel/camel-store-summary.h')
-rw-r--r--camel/camel-store-summary.h162
1 files changed, 162 insertions, 0 deletions
diff --git a/camel/camel-store-summary.h b/camel/camel-store-summary.h
new file mode 100644
index 0000000000..ae0e49d339
--- /dev/null
+++ b/camel/camel-store-summary.h
@@ -0,0 +1,162 @@
+/*
+ * Copyright (C) 2000 Ximian Inc.
+ *
+ * Authors: Michael Zucchi <notzed@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * 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_STORE_SUMMARY_H
+#define _CAMEL_STORE_SUMMARY_H
+
+#include <stdio.h>
+#include <time.h>
+#include <camel/camel-mime-parser.h>
+#include <camel/camel-object.h>
+#include <libibex/ibex.h>
+
+#define CAMEL_STORE_SUMMARY(obj) CAMEL_CHECK_CAST (obj, camel_store_summary_get_type (), CamelStoreSummary)
+#define CAMEL_STORE_SUMMARY_CLASS(klass) CAMEL_CHECK_CLASS_CAST (klass, camel_store_summary_get_type (), CamelStoreSummaryClass)
+#define CAMEL_IS_FOLDER_SUMMARY(obj) CAMEL_CHECK_TYPE (obj, camel_store_summary_get_type ())
+
+typedef struct _CamelStoreSummary CamelStoreSummary;
+typedef struct _CamelStoreSummaryClass CamelStoreSummaryClass;
+
+typedef struct _CamelFolderInfo CamelFolderInfo;
+
+enum _CamelFolderFlags {
+ CAMEL_STORE_SUMMARY_FOLDER_NOSELECT,
+ CAMEL_STORE_SUMMARY_FOLDER_READONLY,
+ CAMEL_STORE_SUMMARY_FOLDER_SUBSCRIBED,
+ CAMEL_STORE_SUMMARY_FOLDER_FLAGGED,
+};
+
+#define CAMEL_STORE_SUMMARY_UNKNOWN (~0)
+
+enum {
+ CAMEL_STORE_SUMMARY_FULL = 0,
+ CAMEL_STORE_SUMMARY_NAME,
+ CAMEL_STORE_SUMMARY_URI,
+ CAMEL_STORE_SUMMARY_LAST,
+};
+
+struct _CamelFolderInfo {
+ guint32 refcount;
+ char *uri;
+ char *full;
+ guint32 flags;
+ guint32 unread;
+ guint32 total;
+};
+
+enum _CamelStoreSummaryFlags {
+ CAMEL_STORE_SUMMARY_DIRTY = 1<<0,
+};
+
+struct _CamelStoreSummary {
+ CamelObject parent;
+
+ struct _CamelStoreSummaryPrivate *priv;
+
+ /* header info */
+ guint32 version; /* version of file required, should be set by implementors */
+ guint32 flags; /* flags */
+ guint32 count; /* how many were saved/loaded */
+ time_t time; /* timestamp for this summary (for implementors to use) */
+
+ /* sizes of memory objects */
+ guint32 folder_info_size;
+
+ /* memory allocators (setup automatically) */
+ struct _EMemChunk *folder_info_chunks;
+
+ char *summary_path;
+ char *uri_prefix;
+
+ GPtrArray *folders; /* CamelFolderInfo's */
+ GHashTable *folders_full; /* CamelFolderInfo's by full name */
+};
+
+struct _CamelStoreSummaryClass {
+ CamelObjectClass parent_class;
+
+ /* load/save the global info */
+ int (*summary_header_load)(CamelStoreSummary *, FILE *);
+ int (*summary_header_save)(CamelStoreSummary *, FILE *);
+
+ /* create/save/load an individual message info */
+ CamelFolderInfo * (*folder_info_new)(CamelStoreSummary *, const char *full);
+ CamelFolderInfo * (*folder_info_load)(CamelStoreSummary *, FILE *);
+ int (*folder_info_save)(CamelStoreSummary *, FILE *, CamelFolderInfo *);
+ void (*folder_info_free)(CamelStoreSummary *, CamelFolderInfo *);
+
+ /* virtualise access methods */
+ const char *(*folder_info_string)(CamelStoreSummary *, const CamelFolderInfo *, int);
+ void (*folder_info_set_string)(CamelStoreSummary *, CamelFolderInfo *, int, const char *);
+};
+
+guint camel_store_summary_get_type (void);
+CamelStoreSummary *camel_store_summary_new (void);
+
+void camel_store_summary_set_filename(CamelStoreSummary *, const char *);
+void camel_store_summary_set_uri_prefix(CamelStoreSummary *, const char *);
+
+/* load/save the summary in its entirety */
+int camel_store_summary_load(CamelStoreSummary *);
+int camel_store_summary_save(CamelStoreSummary *);
+
+/* only load the header */
+int camel_store_summary_header_load(CamelStoreSummary *);
+
+/* set the dirty bit on the summary */
+void camel_store_summary_touch(CamelStoreSummary *s);
+
+/* add a new raw summary item */
+void camel_store_summary_add(CamelStoreSummary *, CamelFolderInfo *info);
+
+/* build/add raw summary items */
+CamelFolderInfo *camel_store_summary_add_from_full(CamelStoreSummary *, const char *);
+
+/* Just build raw summary items */
+CamelFolderInfo *camel_store_summary_info_new(CamelStoreSummary *s);
+CamelFolderInfo *camel_store_summary_info_new_from_full(CamelStoreSummary *s, const char *);
+
+void camel_store_summary_info_ref(CamelStoreSummary *, CamelFolderInfo *);
+void camel_store_summary_info_free(CamelStoreSummary *, CamelFolderInfo *);
+
+/* removes a summary item */
+void camel_store_summary_remove(CamelStoreSummary *s, CamelFolderInfo *info);
+void camel_store_summary_remove_full(CamelStoreSummary *s, const char *full);
+void camel_store_summary_remove_index(CamelStoreSummary *s, int);
+
+/* remove all items */
+void camel_store_summary_clear(CamelStoreSummary *s);
+
+/* lookup functions */
+int camel_store_summary_count(CamelStoreSummary *);
+CamelFolderInfo *camel_store_summary_index(CamelStoreSummary *, int);
+CamelFolderInfo *camel_store_summary_full(CamelStoreSummary *, const char *uid);
+GPtrArray *camel_store_summary_array(CamelStoreSummary *s);
+void camel_store_summary_array_free(CamelStoreSummary *s, GPtrArray *array);
+
+const char *camel_folder_info_string(CamelStoreSummary *, const CamelFolderInfo *, int type);
+void camel_folder_info_set_string(CamelStoreSummary *, CamelFolderInfo *, int type, const char *value);
+
+/* helper macro's */
+#define camel_folder_info_full(s, i) (camel_folder_info_string((CamelStoreSummary *)s, (const CamelFolderInfo *)i, CAMEL_STORE_SUMMARY_FULL))
+#define camel_folder_info_uri(s, i) (camel_folder_info_string((CamelStoreSummary *)s, (const CamelFolderInfo *)i, CAMEL_STORE_SUMMARY_URI))
+#define camel_folder_info_name(s, i) (camel_folder_info_string((CamelStoreSummary *)s, (const CamelFolderInfo *)i, CAMEL_STORE_SUMMARY_NAME))
+
+#endif /* ! _CAMEL_STORE_SUMMARY_H */