[evolution-data-server] Update summary to include uidnext and modseq, and 64-bit uidvalidity
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Update summary to include uidnext and modseq, and 64-bit uidvalidity
- Date: Thu, 24 Jun 2010 13:02:53 +0000 (UTC)
commit 86513477fdff54f503d6f846ef159ab9c6e98fed
Author: David Woodhouse <David Woodhouse intel com>
Date: Thu Jun 24 13:01:21 2010 +0100
Update summary to include uidnext and modseq, and 64-bit uidvalidity
Also set the new fields in imapx_job_scan_changes_done() -- although
the summary's uidvalidity still isn't being set anywhere.
camel/providers/imapx/camel-imapx-server.c | 6 +++
camel/providers/imapx/camel-imapx-summary.c | 53 +++++++++++++++------------
camel/providers/imapx/camel-imapx-summary.h | 4 ++-
3 files changed, 39 insertions(+), 24 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index ec2d476..d98a639 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -3342,12 +3342,18 @@ imapx_job_scan_changes_done(CamelIMAPXServer *is, CamelIMAPXCommand *ic)
CamelMessageInfo *s_minfo = NULL;
CamelIMAPXMessageInfo *info;
CamelFolderSummary *s = job->folder->summary;
+ CamelIMAPXFolder *ifolder = (CamelIMAPXFolder *)job->folder;
GSList *removed = NULL, *l;
gboolean fetch_new = FALSE;
gint i;
guint j = 0;
GPtrArray *uids;
+ /* Actually we wanted to do this after the SELECT but before the
+ FETCH command was issued. But this should suffice. */
+ ((CamelIMAPXSummary *)s)->uidnext = ifolder->uidnext_on_server;
+ ((CamelIMAPXSummary *)s)->modseq = ifolder->modseq_on_server;
+
/* Here we do the typical sort/iterate/merge loop.
If the server flags dont match what we had, we modify our
flags to pick up what the server now has - but we merge
diff --git a/camel/providers/imapx/camel-imapx-summary.c b/camel/providers/imapx/camel-imapx-summary.c
index 8f2a4cc..e512722 100644
--- a/camel/providers/imapx/camel-imapx-summary.c
+++ b/camel/providers/imapx/camel-imapx-summary.c
@@ -33,10 +33,10 @@
#include "camel-imapx-summary.h"
-#define CAMEL_IMAPX_SUMMARY_VERSION (3)
+#define CAMEL_IMAPX_SUMMARY_VERSION (4)
-#define EXTRACT_FIRST_DIGIT(val) val=strtoul (part, &part, 10);
-#define EXTRACT_DIGIT(val) if (*part) part++; val=strtoul (part, &part, 10);
+#define EXTRACT_FIRST_DIGIT(val) val=strtoull (part, &part, 10);
+#define EXTRACT_DIGIT(val) if (*part) part++; val=strtoull (part, &part, 10);
static gint summary_header_load (CamelFolderSummary *, FILE *);
static gint summary_header_save (CamelFolderSummary *, FILE *);
@@ -211,8 +211,15 @@ summary_header_from_db (CamelFolderSummary *s, CamelFIRecord *mir)
EXTRACT_DIGIT (ims->validity)
}
+ if (ims->version >= 4) {
+ if (part)
+ EXTRACT_DIGIT (ims->uidnext);
+ if (part)
+ EXTRACT_DIGIT (ims->modseq);
+ }
+
if (ims->version > CAMEL_IMAPX_SUMMARY_VERSION) {
- g_warning("Unkown summary version\n");
+ g_warning("Unknown summary version\n");
errno = EINVAL;
return -1;
}
@@ -225,6 +232,8 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
{
CamelIMAPXSummary *ims = CAMEL_IMAPX_SUMMARY (s);
CamelFolderSummaryClass *folder_summary_class;
+ guint32 validity;
+ gint ret;
folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (
camel_imapx_summary_parent_class);
@@ -233,8 +242,12 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
return -1;
/* Legacy version */
- if (s->version == 0x30c)
- return camel_file_util_decode_uint32(in, &ims->validity);
+ if (s->version == 0x30c) {
+ ret = camel_file_util_decode_uint32(in, &validity);
+ if (!ret)
+ ims->validity = validity;
+ return ret;
+ }
/* Version 1 */
if (camel_file_util_decode_fixed_int32(in, (gint32 *) &ims->version) == -1)
@@ -248,11 +261,14 @@ summary_header_load (CamelFolderSummary *s, FILE *in)
return -1;
}
- if (camel_file_util_decode_fixed_int32(in, (gint32 *) &ims->validity) == -1)
+ if (camel_file_util_decode_fixed_int32(in, (gint32 *) &validity) == -1)
return -1;
+ ims->validity = validity;
- if (ims->version > CAMEL_IMAPX_SUMMARY_VERSION) {
- g_warning("Unkown summary version\n");
+ /* This is only used for migration; will never be asked to load newer
+ versions of the store format */
+ if (ims->version > 3) {
+ g_warning("Unknown summary version\n");
errno = EINVAL;
return -1;
}
@@ -273,26 +289,17 @@ summary_header_to_db (CamelFolderSummary *s, CamelException *ex)
fir = folder_summary_class->summary_header_to_db (s, ex);
if (!fir)
return NULL;
- fir->bdata = g_strdup_printf ("%d %u", CAMEL_IMAPX_SUMMARY_VERSION, ims->validity);
-
+ fir->bdata = g_strdup_printf ("%d %llu %u %llu", CAMEL_IMAPX_SUMMARY_VERSION,
+ (unsigned long long)ims->validity, ims->uidnext,
+ (unsigned long long)ims->modseq);
return fir;
}
static gint
summary_header_save (CamelFolderSummary *s, FILE *out)
{
- CamelIMAPXSummary *ims = CAMEL_IMAPX_SUMMARY(s);
- CamelFolderSummaryClass *folder_summary_class;
-
- folder_summary_class = CAMEL_FOLDER_SUMMARY_CLASS (
- camel_imapx_summary_parent_class);
-
- if (folder_summary_class->summary_header_save (s, out) == -1)
- return -1;
-
- camel_file_util_encode_fixed_int32(out, CAMEL_IMAPX_SUMMARY_VERSION);
-
- return camel_file_util_encode_fixed_int32(out, ims->validity);
+ g_warning("imapx %s called; should never happen!\n", __func__);
+ return -1;
}
static CamelMessageInfo *
diff --git a/camel/providers/imapx/camel-imapx-summary.h b/camel/providers/imapx/camel-imapx-summary.h
index e37772c..438900c 100644
--- a/camel/providers/imapx/camel-imapx-summary.h
+++ b/camel/providers/imapx/camel-imapx-summary.h
@@ -72,7 +72,9 @@ struct _CamelIMAPXSummary {
CamelFolderSummary parent;
guint32 version;
- guint32 validity;
+ guint32 uidnext;
+ guint64 validity;
+ guint64 modseq;
};
struct _CamelIMAPXSummaryClass {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]