[evolution-mapi] Bug #655409 - Extra flags in CamelStoreInfo break folder type check



commit dc6ae8a95adc90af5b379b6beca5ad6988e64856
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jul 27 22:43:54 2011 +0200

    Bug #655409 - Extra flags in CamelStoreInfo break folder type check

 src/camel/camel-mapi-store-summary.c |   37 +++++++++++++++++++++------------
 src/camel/camel-mapi-store-summary.h |    6 -----
 src/camel/camel-mapi-store.h         |    3 --
 3 files changed, 23 insertions(+), 23 deletions(-)
---
diff --git a/src/camel/camel-mapi-store-summary.c b/src/camel/camel-mapi-store-summary.c
index f6e05a9..c85d68f 100644
--- a/src/camel/camel-mapi-store-summary.c
+++ b/src/camel/camel-mapi-store-summary.c
@@ -73,8 +73,6 @@ camel_mapi_store_summary_init (CamelMapiStoreSummary *mapi_store_summary)
 
 	store_summary = CAMEL_STORE_SUMMARY (mapi_store_summary);
 	store_summary->store_info_size = sizeof (CamelMapiStoreInfo);
-
-	mapi_store_summary->version = CAMEL_MAPI_STORE_SUMMARY_VERSION;
 }
 
 CamelMapiStoreSummary *
@@ -86,19 +84,14 @@ camel_mapi_store_summary_new (void)
 static gint
 summary_header_load(CamelStoreSummary *s, FILE *in)
 {
-	CamelMapiStoreSummary *summary = (CamelMapiStoreSummary *)s;
 	CamelStoreSummaryClass *store_summary_class;
 
 	store_summary_class = CAMEL_STORE_SUMMARY_CLASS (
 		camel_mapi_store_summary_parent_class);
 
-	/* TODO */
 	if (store_summary_class->summary_header_load (s, in) == -1)
-			/* || camel_file_util_decode_fixed_int32(in, &version) == -1) */
 		return -1;
 
-	summary->version = 0;
-
 	return 0;
 }
 
@@ -120,21 +113,37 @@ static CamelStoreInfo *
 store_info_load(CamelStoreSummary *s, FILE *in)
 {
 	CamelStoreSummaryClass *store_summary_class;
-	CamelMapiStoreInfo *si;
+	CamelStoreInfo *si;
+	CamelMapiStoreInfo *msi;
 
 	store_summary_class = CAMEL_STORE_SUMMARY_CLASS (
 		camel_mapi_store_summary_parent_class);
 
-	si = (CamelMapiStoreInfo *)store_summary_class->store_info_load(s, in);
+	si = store_summary_class->store_info_load(s, in);
 	if (si) {
-		if (camel_file_util_decode_string(in, &si->full_name) == -1
-		    || camel_file_util_decode_string(in, &si->folder_id) == -1
-		    || camel_file_util_decode_string(in, &si->parent_id) == -1) {
-			camel_store_summary_info_free(s, (CamelStoreInfo *)si);
+		msi = (CamelMapiStoreInfo *) si;
+		if (camel_file_util_decode_string(in, &msi->full_name) == -1
+		    || camel_file_util_decode_string(in, &msi->folder_id) == -1
+		    || camel_file_util_decode_string(in, &msi->parent_id) == -1) {
+			camel_store_summary_info_free (s, si);
 			si = NULL;
+		} else if (((si->flags >> 13) & (CAMEL_FOLDER_TYPE_MASK >> 13)) != 0) {
+			guint32 old_flags = si->flags;
+
+			si->flags = (si->flags & ((1 << 13) - 1));
+
+			if (old_flags & ((1 << 13) << 1))
+				si->flags |= CAMEL_MAPI_FOLDER_PUBLIC;
+			if (old_flags & ((1 << 13) << 2))
+				si->flags |= CAMEL_MAPI_FOLDER_PERSONAL;
+			if (old_flags & ((1 << 13) << 3))
+				si->flags |= CAMEL_MAPI_FOLDER_FORIEGN;
+			if (old_flags & ((1 << 13) << 4))
+				si->flags |= CAMEL_MAPI_FOLDER_MAIL;
 		}
 	}
-	return (CamelStoreInfo *)si;
+
+	return si;
 }
 
 static gint
diff --git a/src/camel/camel-mapi-store-summary.h b/src/camel/camel-mapi-store-summary.h
index 0094b78..5a11e57 100644
--- a/src/camel/camel-mapi-store-summary.h
+++ b/src/camel/camel-mapi-store-summary.h
@@ -26,8 +26,6 @@
 
 #include <camel/camel.h>
 
-#define CAMEL_MAPI_STORE_SUMMARY_VERSION (0)
-
 /* Standard GObject macros */
 #define CAMEL_TYPE_MAPI_STORE_SUMMARY \
 	(camel_mapi_store_summary_get_type ())
@@ -72,10 +70,6 @@ struct _CamelMapiStoreInfo {
 struct _CamelMapiStoreSummary {
 	CamelStoreSummary parent;
 	CamelMapiStoreSummaryPrivate *priv;
-
-	/* header info */
-	guint32 version;        /* version of base part of file */
-	guint32 capabilities;
 };
 
 struct _CamelMapiStoreSummaryClass {
diff --git a/src/camel/camel-mapi-store.h b/src/camel/camel-mapi-store.h
index e95fd2b..ddf2a44 100644
--- a/src/camel/camel-mapi-store.h
+++ b/src/camel/camel-mapi-store.h
@@ -50,9 +50,6 @@
 	(G_TYPE_INSTANCE_GET_CLASS \
 	((obj), CAMEL_TYPE_MAPI_STORE, CamelMapiStoreClass))
 
-/* TODO : Move this to libcamel. Task when merging */
-#define CAMEL_FOLDER_FLAGS_LAST (1<<13)
-
 #define CAMEL_MAPI_FOLDER_PUBLIC (CAMEL_FOLDER_FLAGS_LAST << 1)
 #define CAMEL_MAPI_FOLDER_PERSONAL (CAMEL_FOLDER_FLAGS_LAST << 2)
 #define CAMEL_MAPI_FOLDER_FORIEGN (CAMEL_FOLDER_FLAGS_LAST << 3)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]