[evolution-data-server/imap-notify: 27/40] CamelIMAPXStoreSummary: Stop saving namespace information.
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/imap-notify: 27/40] CamelIMAPXStoreSummary: Stop saving namespace information.
- Date: Thu, 12 Sep 2013 17:03:48 +0000 (UTC)
commit 540c41d523cdff3d4dfdd4a622e87cc8559e72f3
Author: Matthew Barnes <mbarnes redhat com>
Date: Wed Sep 11 16:52:31 2013 -0400
CamelIMAPXStoreSummary: Stop saving namespace information.
We don't need namespace information when operating offline.
camel/camel-imapx-store-summary.c | 135 ++++++++++---------------------------
1 files changed, 37 insertions(+), 98 deletions(-)
---
diff --git a/camel/camel-imapx-store-summary.c b/camel/camel-imapx-store-summary.c
index b577e43..ea357fd 100644
--- a/camel/camel-imapx-store-summary.c
+++ b/camel/camel-imapx-store-summary.c
@@ -49,118 +49,49 @@ G_DEFINE_TYPE (
CAMEL_TYPE_STORE_SUMMARY)
-static CamelIMAPXNamespaceList *
-namespace_load (CamelStoreSummary *s,
- FILE *in)
+static gboolean
+namespace_load (FILE *in)
{
- CamelIMAPXStoreNamespace *ns, *tail;
- CamelIMAPXNamespaceList *nsl;
- guint32 i, j;
- gint32 n;
+ gchar *unused = NULL;
+ gboolean success;
+ guint32 j;
- nsl = g_malloc0 (sizeof (CamelIMAPXNamespaceList));
- nsl->personal = NULL;
- nsl->shared = NULL;
- nsl->other = NULL;
+ /* XXX This eats through the old namespace data for backward
+ * compatibility. Next time we bump the summary version,
+ * delete all this cruft. */
for (j = 0; j < 3; j++) {
- switch (j) {
- case 0:
- tail = (CamelIMAPXStoreNamespace *) &nsl->personal;
- break;
- case 1:
- tail = (CamelIMAPXStoreNamespace *) &nsl->shared;
- break;
- case 2:
- tail = (CamelIMAPXStoreNamespace *) &nsl->other;
- break;
- }
+ gint32 i, n;
if (camel_file_util_decode_fixed_int32 (in, &n) == -1)
- goto fail;
+ goto exit;
for (i = 0; i < n; i++) {
guint32 sep;
- gchar *prefix;
- gchar *unused;
-
- if (camel_file_util_decode_string (in, &prefix) == -1)
- goto fail;
- /* XXX This string is just a duplicate of 'prefix',
- * retained only for backward-compatibility. */
- if (camel_file_util_decode_string (in, &unused) == -1) {
- g_free (prefix);
- goto fail;
- }
+ if (camel_file_util_decode_string (in, &unused) == -1)
+ goto exit;
g_free (unused);
+ unused = NULL;
- if (camel_file_util_decode_uint32 (in, &sep) == -1) {
- g_free (prefix);
- goto fail;
- }
-
- tail->next = ns = g_malloc (sizeof (CamelIMAPXStoreNamespace));
- ns->sep = sep;
- ns->prefix = prefix;
- ns->next = NULL;
- tail = ns;
- }
- }
-
- return nsl;
+ if (camel_file_util_decode_string (in, &unused) == -1)
+ goto exit;
-fail:
- camel_imapx_namespace_list_clear (nsl);
-
- return NULL;
-}
-
-static gint
-namespace_save (CamelStoreSummary *s,
- FILE *out,
- CamelIMAPXNamespaceList *nsl)
-{
- CamelIMAPXStoreNamespace *ns, *cur = NULL;
- guint32 i, n;
+ g_free (unused);
+ unused = NULL;
- for (i = 0; i < 3; i++) {
- switch (i) {
- case 0:
- cur = nsl->personal;
- break;
- case 1:
- cur = nsl->shared;
- break;
- case 2:
- cur = nsl->other;
- break;
+ if (camel_file_util_decode_uint32 (in, &sep) == -1)
+ goto exit;
}
+ }
- for (ns = cur, n = 0; ns; n++)
- ns = ns->next;
-
- if (camel_file_util_encode_fixed_int32 (out, n) == -1)
- return -1;
-
- ns = cur;
- while (ns != NULL) {
- if (camel_file_util_encode_string (out, ns->prefix) == -1)
- return -1;
-
- /* XXX This redundancy is for backward-compatibility. */
- if (camel_file_util_encode_string (out, ns->prefix) == -1)
- return -1;
+ success = TRUE;
- if (camel_file_util_encode_uint32 (out, ns->sep) == -1)
- return -1;
+exit:
+ g_free (unused);
- ns = ns->next;
- }
- }
-
- return 0;
+ return success;
}
static void
@@ -209,12 +140,11 @@ imapx_store_summary_summary_header_load (CamelStoreSummary *s,
return -1;
}
- /* note file format can be expanded to contain more namespaces, but only 1 at the moment */
if (camel_file_util_decode_fixed_int32 (in, &unused) == -1)
return -1;
- /* namespaces */
- if ((is->namespaces = namespace_load (s, in)) == NULL)
+ /* XXX This just eats old data that we no longer use. */
+ if (!namespace_load (in))
return -1;
return 0;
@@ -224,7 +154,6 @@ static gint
imapx_store_summary_summary_header_save (CamelStoreSummary *s,
FILE *out)
{
- CamelIMAPXStoreSummary *is = (CamelIMAPXStoreSummary *) s;
CamelStoreSummaryClass *store_summary_class;
store_summary_class =
@@ -242,7 +171,17 @@ imapx_store_summary_summary_header_save (CamelStoreSummary *s,
if (camel_file_util_encode_fixed_int32 (out, 0) == -1)
return -1;
- if (is->namespaces && namespace_save (s, out, is->namespaces) == -1)
+ /* XXX This just saves zero-count namespace placeholders for
+ * backward compatibility. Next time we bump the summary
+ * version, delete all this cruft. */
+
+ if (camel_file_util_encode_fixed_int32 (out, 0) == -1)
+ return -1;
+
+ if (camel_file_util_encode_fixed_int32 (out, 0) == -1)
+ return -1;
+
+ if (camel_file_util_encode_fixed_int32 (out, 0) == -1)
return -1;
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]