aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-local-summary.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-02-16 17:38:24 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-02-16 17:38:24 +0800
commit1ceb4cd764fbdd89a3b67903251dc89ad3e7d723 (patch)
treea551592e442ee3404caa5d05a8362d7dd1d553b0 /camel/providers/local/camel-local-summary.c
parent22fdff59a00dbbdcc6c6a59f452cfa7141bc7aad (diff)
downloadgsoc2013-evolution-1ceb4cd764fbdd89a3b67903251dc89ad3e7d723.tar
gsoc2013-evolution-1ceb4cd764fbdd89a3b67903251dc89ad3e7d723.tar.gz
gsoc2013-evolution-1ceb4cd764fbdd89a3b67903251dc89ad3e7d723.tar.bz2
gsoc2013-evolution-1ceb4cd764fbdd89a3b67903251dc89ad3e7d723.tar.lz
gsoc2013-evolution-1ceb4cd764fbdd89a3b67903251dc89ad3e7d723.tar.xz
gsoc2013-evolution-1ceb4cd764fbdd89a3b67903251dc89ad3e7d723.tar.zst
gsoc2013-evolution-1ceb4cd764fbdd89a3b67903251dc89ad3e7d723.zip
** See bug #51045.
2004-02-16 Not Zed <NotZed@Ximian.com> ** See bug #51045. * providers/imap/camel-imap-store.c (fill_fi): similar to mbox version. (get_folder_counts): use fill_fi to try and get folder counts if we're not doing the hard slog. (get_one_folder_offline): use fill_fi to try to get folder counts from open folders or summaries. * providers/local/camel-maildir-store.c (fill_fi): similar to mbox version. (scan_dir): use fill_fi to get the unread count now. * providers/local/camel-mbox-store.c (fill_fi): helper to lookup unread count either from active folder or from summary file, if it's available. (scan_dir, get_folder_info): use helper above to get folder info. * devel-docs/camel-folder-summary.txt: New document describing the format/conventions in the CamelFolderSummary file. * providers/nntp/camel-nntp-summary.c (summary_header_load/save): * providers/imapp/camel-imapp-summary.c (summary_header_load/save): * providers/imap/camel-imap-summary.c (summary_header_load/save): Handle versions, per-class version number (1). * providers/local/camel-mbox-summary.c (summary_header_load/save): Handle versions properly, add a per-class version (1). Write out the folder size as a size_t rather than 32 bit int. * providers/local/camel-local-summary.c (summary_header_load/save): read/write the per-class version number (1). * camel-folder-summary.c (summary_header_load): do version checking differently, allow the version to be bumped without aborting the load. Added unread/deleted/junk counts to base header. (summary_header_save): Save out the new-format header. Version bumped to 13. * camel.c (camel_init): return 0 rather than spit a compiler warning. * camel-file-utils.c (camel_file_util_encode_*_t): macro-ise the type encoder/decoders. Also add size_t encoder/decoder. svn path=/trunk/; revision=24744
Diffstat (limited to 'camel/providers/local/camel-local-summary.c')
-rw-r--r--camel/providers/local/camel-local-summary.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/camel/providers/local/camel-local-summary.c b/camel/providers/local/camel-local-summary.c
index 42534b361d..a1f4831675 100644
--- a/camel/providers/local/camel-local-summary.c
+++ b/camel/providers/local/camel-local-summary.c
@@ -34,12 +34,16 @@
#include "camel-local-summary.h"
#include "camel/camel-mime-message.h"
#include "camel/camel-stream-null.h"
+#include "camel/camel-file-utils.h"
#define w(x)
#define io(x)
#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
-#define CAMEL_LOCAL_SUMMARY_VERSION (0x200)
+#define CAMEL_LOCAL_SUMMARY_VERSION (1)
+
+static int summary_header_load (CamelFolderSummary *, FILE *);
+static int summary_header_save (CamelFolderSummary *, FILE *);
static CamelMessageInfo * message_info_new (CamelFolderSummary *, struct _camel_header_raw *);
@@ -81,6 +85,9 @@ camel_local_summary_class_init(CamelLocalSummaryClass *klass)
camel_local_summary_parent = CAMEL_FOLDER_SUMMARY_CLASS(camel_type_get_global_classfuncs(camel_folder_summary_get_type()));
+ sklass->summary_header_load = summary_header_load;
+ sklass->summary_header_save = summary_header_save;
+
sklass->message_info_new = message_info_new;
klass->load = local_summary_load;
@@ -577,6 +584,35 @@ local_summary_decode_x_evolution(CamelLocalSummary *cls, const char *xev, CamelM
return 0;
}
+static int
+summary_header_load(CamelFolderSummary *s, FILE *in)
+{
+ CamelLocalSummary *cls = (CamelLocalSummary *)s;
+
+ /* We dont actually add our own headers, but version that we don't anyway */
+
+ if (((CamelFolderSummaryClass *)camel_local_summary_parent)->summary_header_load(s, in) == -1)
+ return -1;
+
+ /* Legacy version, version is in summary only */
+ if ((s->version & 0xfff) == 0x20c)
+ return 0;
+
+ /* otherwise load the version number */
+ return camel_file_util_decode_fixed_int32(in, &cls->version);
+}
+
+static int
+summary_header_save(CamelFolderSummary *s, FILE *out)
+{
+ /*CamelLocalSummary *cls = (CamelLocalSummary *)s;*/
+
+ if (((CamelFolderSummaryClass *)camel_local_summary_parent)->summary_header_save(s, out) == -1)
+ return -1;
+
+ return camel_file_util_encode_fixed_int32(out, CAMEL_LOCAL_SUMMARY_VERSION);
+}
+
static CamelMessageInfo *
message_info_new(CamelFolderSummary *s, struct _camel_header_raw *h)
{