aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-folder-summary.h
diff options
context:
space:
mode:
authorNotZed <NotZed@HelixCode.com>2000-05-04 13:45:30 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-04 13:45:30 +0800
commitf8bfbef0a705629ae2aefa71dc06b7d64fbd5274 (patch)
tree6d6619bb0e8d138ee311f119f1c661a48236f5a7 /camel/camel-folder-summary.h
parent8e733f83054d1f3c5fe5837360613ce5088a117c (diff)
downloadgsoc2013-evolution-f8bfbef0a705629ae2aefa71dc06b7d64fbd5274.tar
gsoc2013-evolution-f8bfbef0a705629ae2aefa71dc06b7d64fbd5274.tar.gz
gsoc2013-evolution-f8bfbef0a705629ae2aefa71dc06b7d64fbd5274.tar.bz2
gsoc2013-evolution-f8bfbef0a705629ae2aefa71dc06b7d64fbd5274.tar.lz
gsoc2013-evolution-f8bfbef0a705629ae2aefa71dc06b7d64fbd5274.tar.xz
gsoc2013-evolution-f8bfbef0a705629ae2aefa71dc06b7d64fbd5274.tar.zst
gsoc2013-evolution-f8bfbef0a705629ae2aefa71dc06b7d64fbd5274.zip
No, we're not going to have g_strcasecmp for no good reason,
not even if its slipped in with no changelog. 2000-05-04 NotZed <NotZed@HelixCode.com> * providers/mbox/camel-mbox-summary.c: Yes, and anotherone. * camel-mime-utils.c: And another one. * camel-mime-part.c: And another one. * camel-mime-part-utils.c: And another one. * camel-folder-search.c: And another one. * camel-mime-parser.c: Reverted a change wihtout a ChangeLog entry. 2000-05-04 NotZed <NotZed@HelixCode.com> * camel-folder-summary.[hc]: Yes, CamelFolderSummary is back ... ... re-usable class to summarise and index any stream or message and to manage/load/save the created summaries. * camel-folder.c: Include string.h to kill a warning. 2000-05-03 NotZed <NotZed@HelixCode.com> * camel-folder.h: Added pos/bodypos/endpos to the basic message content info object. Size to be removed? Moved the messageconentinfo and messageinfo back to camel-folder-summary.h. * camel-mime-filter-index.c (camel_mime_filter_index_set_ibex): New function to (re)set the index to use on a filter. * camel-mime-parser.c (camel_mime_parser_scan_from): Whole bunch of inline docs. (camel_mime_parser_drop_step): New function to drop a state from the parser. Needs more testing. svn path=/trunk/; revision=2789
Diffstat (limited to 'camel/camel-folder-summary.h')
-rw-r--r--camel/camel-folder-summary.h181
1 files changed, 181 insertions, 0 deletions
diff --git a/camel/camel-folder-summary.h b/camel/camel-folder-summary.h
new file mode 100644
index 0000000000..69045d6931
--- /dev/null
+++ b/camel/camel-folder-summary.h
@@ -0,0 +1,181 @@
+/*
+ * 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_FOLDER_SUMMARY_H
+#define _CAMEL_FOLDER_SUMMARY_H
+
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <time.h>
+#include <camel/camel-mime-parser.h>
+#include <libibex/ibex.h>
+
+#define CAMEL_FOLDER_SUMMARY(obj) GTK_CHECK_CAST (obj, camel_folder_summary_get_type (), CamelFolderSummary)
+#define CAMEL_FOLDER_SUMMARY_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, camel_folder_summary_get_type (), CamelFolderSummaryClass)
+#define IS_CAMEL_FOLDER_SUMMARY(obj) GTK_CHECK_TYPE (obj, camel_folder_summary_get_type ())
+
+/*typedef struct _CamelFolderSummary CamelFolderSummary;*/
+typedef struct _CamelFolderSummaryClass CamelFolderSummaryClass;
+
+/* these structs from camel-folder-summary.h ... (remove comment after cleanup soon) */
+/* TODO: perhaps they should be full-block objects? */
+/* FIXME: rename this to something more suitable */
+typedef struct {
+ gchar *name;
+ gint nb_message; /* ick, these should be renamed to something better */
+ gint nb_unread_message;
+ gint nb_deleted_message;
+} CamelFolderInfo;
+
+/* A tree of message content info structures
+ describe the content structure of the message (if it has any) */
+typedef struct _CamelMessageContentInfo {
+ struct _CamelMessageContentInfo *next;
+
+ struct _CamelMessageContentInfo *childs;
+ struct _CamelMessageContentInfo *parent;
+
+ struct _header_content_type *type;
+ char *id;
+ char *description;
+ char *encoding;
+
+ /* information about where this object lives in the stream.
+ if pos is -1 these are all invalid */
+ off_t pos;
+ off_t bodypos;
+ off_t endpos;
+} CamelMessageContentInfo;
+
+/* information about a given object */
+typedef struct {
+ /* public fields */
+ gchar *subject;
+ gchar *to;
+ gchar *from;
+
+ gchar *uid;
+ guint32 flags;
+ guint32 size;
+
+ time_t date_sent;
+ time_t date_received;
+
+ /* tree of content description - NULL if it is not available */
+ CamelMessageContentInfo *content;
+} CamelMessageInfo;
+
+enum _CamelFolderSummaryFlags {
+ CAMEL_SUMMARY_DIRTY = 1<<0,
+};
+
+struct _CamelFolderSummary {
+ GtkObject parent;
+
+ struct _CamelFolderSummaryPrivate *priv;
+
+ /* header info */
+ guint32 version; /* version of file required, should be set by implementors */
+ guint32 flags; /* flags */
+ guint32 nextuid; /* next uid? */
+ guint32 saved_count; /* how many were saved/loaded */
+ time_t time; /* timestamp for this summary */
+
+ /* sizes of memory objects */
+ guint32 message_info_size;
+ guint32 content_info_size;
+
+ char *summary_path;
+ gboolean build_content; /* do we try and parse/index the content, or not? */
+
+ GPtrArray *messages; /* CamelMessageInfo's */
+ GHashTable *messages_uid; /* CamelMessageInfo's by uid */
+};
+
+struct _CamelFolderSummaryClass {
+ GtkObjectClass parent_class;
+
+ /* load/save the global info */
+ int (*summary_header_load)(CamelFolderSummary *, FILE *);
+ int (*summary_header_save)(CamelFolderSummary *, FILE *);
+
+ /* create/save/load an individual message info */
+ CamelMessageInfo * (*message_info_new)(CamelFolderSummary *, struct _header_raw *);
+ CamelMessageInfo * (*message_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
+ CamelMessageInfo * (*message_info_load)(CamelFolderSummary *, FILE *);
+ int (*message_info_save)(CamelFolderSummary *, FILE *, CamelMessageInfo *);
+ void (*message_info_free)(CamelFolderSummary *, CamelMessageInfo *);
+
+ /* save/load individual content info's */
+ CamelMessageContentInfo * (*content_info_new)(CamelFolderSummary *, struct _header_raw *);
+ CamelMessageContentInfo * (*content_info_new_from_parser)(CamelFolderSummary *, CamelMimeParser *);
+ CamelMessageContentInfo * (*content_info_load)(CamelFolderSummary *, FILE *);
+ int (*content_info_save)(CamelFolderSummary *, FILE *, CamelMessageContentInfo *);
+ void (*content_info_free)(CamelFolderSummary *, CamelMessageContentInfo *);
+};
+
+guint camel_folder_summary_get_type (void);
+CamelFolderSummary *camel_folder_summary_new (void);
+
+void camel_folder_summary_set_filename(CamelFolderSummary *, const char *);
+void camel_folder_summary_set_index(CamelFolderSummary *, ibex *);
+void camel_folder_summary_set_uid(CamelFolderSummary *, guint32);
+void camel_folder_summary_set_build_content(CamelFolderSummary *, gboolean state);
+
+guint32 camel_folder_summary_next_uid(CamelFolderSummary *s);
+
+/* load/save the summary in its entirety */
+int camel_folder_summary_load(CamelFolderSummary *);
+int camel_folder_summary_save(CamelFolderSummary *);
+
+/* add a new raw summary item */
+void camel_folder_summary_add(CamelFolderSummary *, CamelMessageInfo *info);
+void camel_folder_summary_add_from_header(CamelFolderSummary *, struct _header_raw *);
+void camel_folder_summary_add_from_parser(CamelFolderSummary *, CamelMimeParser *);
+
+/* removes a summary item, fixes offsets? */
+void camel_mbox_summary_remove_uid(CamelFolderSummary *s, const char *uid);
+
+/* lookup functions */
+int camel_folder_summary_count(CamelFolderSummary *);
+CamelMessageInfo *camel_folder_summary_index(CamelFolderSummary *, int);
+CamelMessageInfo *camel_folder_summary_uid(CamelFolderSummary *, const char *uid);
+
+/* utility functions */
+void camel_folder_summary_set_flags_by_uid(CamelFolderSummary *s, const char *uid, guint32 flags);
+/* shift content ... */
+void camel_folder_summary_offset_content(CamelMessageContentInfo *content, off_t offset);
+
+/* summary file loading/saving helper functions */
+int camel_folder_summary_encode_fixed_int32(FILE *, gint32);
+int camel_folder_summary_decode_fixed_int32(FILE *, gint32 *);
+
+int camel_folder_summary_encode_uint32(FILE *, guint32);
+int camel_folder_summary_decode_uint32(FILE *, guint32 *);
+
+int camel_folder_summary_encode_string(FILE *, char *);
+int camel_folder_summary_decode_string(FILE *, char **);
+
+/* basically like strings, but certain keywords can be compressed and de-cased */
+int camel_folder_summary_encode_token(FILE *, char *);
+int camel_folder_summary_decode_token(FILE *, char **);
+
+#endif /* ! _CAMEL_FOLDER_SUMMARY_H */