aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/local/camel-maildir-store.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-maildir-store.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-maildir-store.c')
-rw-r--r--camel/providers/local/camel-maildir-store.c46
1 files changed, 44 insertions, 2 deletions
diff --git a/camel/providers/local/camel-maildir-store.c b/camel/providers/local/camel-maildir-store.c
index 0eff01f1d2..df17bcd5d9 100644
--- a/camel/providers/local/camel-maildir-store.c
+++ b/camel/providers/local/camel-maildir-store.c
@@ -36,6 +36,7 @@
#include "camel-exception.h"
#include "camel-url.h"
#include "camel-private.h"
+#include "camel-maildir-summary.h"
#define d(x)
@@ -237,6 +238,45 @@ static CamelFolderInfo *camel_folder_info_new(const char *url, const char *full,
return fi;
}
+static void
+fill_fi(CamelStore *store, CamelFolderInfo *fi, guint32 flags)
+{
+ CamelFolder *folder;
+ int unread = -1;
+
+ folder = camel_object_bag_get(store->folders, fi->full_name);
+ if (folder) {
+ if ((flags & CAMEL_STORE_FOLDER_INFO_FAST) == 0)
+ camel_folder_refresh_info(folder, NULL);
+ unread = camel_folder_get_unread_message_count(folder);
+ camel_object_unref(folder);
+ } else {
+ char *path, *folderpath;
+ CamelFolderSummary *s;
+ const char *root;
+
+ printf("looking up counts from '%s'\n", fi->full_name);
+
+ /* This should be fast enough not to have to test for INFO_FAST */
+ root = camel_local_store_get_toplevel_dir((CamelLocalStore *)store);
+ path = g_strdup_printf("%s/%s.ev-summary", root, fi->full_name);
+ folderpath = g_strdup_printf("%s/%s", root, fi->full_name);
+ s = (CamelFolderSummary *)camel_maildir_summary_new(path, folderpath, NULL);
+ if (camel_folder_summary_header_load(s) != -1) {
+ unread = s->unread_count;
+ printf("loaded summary header unread = %d\n", unread);
+ } else {
+ printf("couldn't load summary header?\n");
+ }
+
+ camel_object_unref(s);
+ g_free(folderpath);
+ g_free(path);
+ }
+
+ fi->unread_message_count = unread;
+}
+
/* used to find out where we've visited already */
struct _inode {
dev_t dnode;
@@ -316,8 +356,10 @@ static int scan_dir(CamelStore *store, GHashTable *visited, char *root, const ch
}
}
- fi = camel_folder_info_new(uri, path, base, unread);
-
+ fi = camel_folder_info_new(uri, path, base, -1);
+ /* fills the unread count */
+ fill_fi(store, fi, flags);
+
d(printf("found! uri = %s\n", fi->url));
d(printf(" full_name = %s\n name = '%s'\n", fi->full_name, fi->name));