[evolution-mapi] PidTagLastModificationTime doesn't work as expected on a folder object



commit d6175ecbc111bfb4378050c7ed415ca365a9f712
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 1 08:55:13 2011 +0100

    PidTagLastModificationTime doesn't work as expected on a folder object

 src/camel/camel-mapi-store-summary.c    |   28 +++++-----------------------
 src/camel/camel-mapi-store-summary.h    |    4 +---
 src/camel/camel-mapi-store.c            |   12 +++++-------
 src/libexchangemapi/e-mapi-connection.c |   23 ++++++-----------------
 src/libexchangemapi/e-mapi-folder.c     |    3 +--
 src/libexchangemapi/e-mapi-folder.h     |    4 +---
 6 files changed, 19 insertions(+), 55 deletions(-)
---
diff --git a/src/camel/camel-mapi-store-summary.c b/src/camel/camel-mapi-store-summary.c
index 8ed118c..35cf80d 100644
--- a/src/camel/camel-mapi-store-summary.c
+++ b/src/camel/camel-mapi-store-summary.c
@@ -130,7 +130,7 @@ store_info_load (CamelStoreSummary *s, FILE *in)
 
 	si = store_summary_class->store_info_load (s, in);
 	if (si) {
-		gchar *folder_id_str = NULL, *parent_id_str = NULL, *last_modified_str = NULL;
+		gchar *folder_id_str = NULL, *parent_id_str = NULL;
 
 		msi = (CamelMapiStoreInfo *) si;
 		if (camel_file_util_decode_string (in, &folder_id_str) == -1
@@ -138,18 +138,11 @@ store_info_load (CamelStoreSummary *s, FILE *in)
 		    || camel_file_util_decode_uint32 (in, &msi->camel_folder_flags) == -1
 		    || camel_file_util_decode_uint32 (in, &msi->mapi_folder_flags) == -1
 		    || camel_file_util_decode_string (in, &msi->foreign_user_name) == -1
-		    || camel_file_util_decode_string (in, &last_modified_str) == -1
 		    || !e_mapi_util_mapi_id_from_string (folder_id_str, &msi->folder_mid)
-		    || !e_mapi_util_mapi_id_from_string (parent_id_str, &msi->parent_mid)
-		    || !last_modified_str || !*last_modified_str) {
+		    || !e_mapi_util_mapi_id_from_string (parent_id_str, &msi->parent_mid)) {
 			camel_store_summary_info_free (s, si);
 			si = NULL;
 		} else {
-			GTimeVal tv;
-
-			if (g_time_val_from_iso8601 (last_modified_str, &tv))
-				msi->last_modified = tv.tv_sec;
-
 			if (msi->foreign_user_name && !*msi->foreign_user_name) {
 				g_free (msi->foreign_user_name);
 				msi->foreign_user_name = NULL;
@@ -158,7 +151,6 @@ store_info_load (CamelStoreSummary *s, FILE *in)
 
 		g_free (folder_id_str);
 		g_free (parent_id_str);
-		g_free (last_modified_str);
 	}
 
 	return si;
@@ -169,34 +161,26 @@ store_info_save (CamelStoreSummary *s, FILE *out, CamelStoreInfo *si)
 {
 	CamelMapiStoreInfo *msi = (CamelMapiStoreInfo *) si;
 	CamelStoreSummaryClass *store_summary_class;
-	gchar *folder_id_str = NULL, *parent_id_str = NULL, *last_modified_str = NULL;
-	GTimeVal tv = { 0 };
+	gchar *folder_id_str = NULL, *parent_id_str = NULL;
 	gint res = -1;
 
 	store_summary_class = CAMEL_STORE_SUMMARY_CLASS (camel_mapi_store_summary_parent_class);
 
-	tv.tv_sec = msi->last_modified;
-
 	folder_id_str = e_mapi_util_mapi_id_to_string (msi->folder_mid);
 	parent_id_str = e_mapi_util_mapi_id_to_string (msi->parent_mid);
-	last_modified_str = g_time_val_to_iso8601 (&tv);
-	if (!last_modified_str)
-		last_modified_str = g_strdup (" ");
 
 	if (store_summary_class->store_info_save (s, out, si) == -1
 	    || camel_file_util_encode_string (out, folder_id_str) == -1
 	    || camel_file_util_encode_string (out, parent_id_str) == -1
 	    || camel_file_util_encode_uint32 (out, msi->camel_folder_flags) == -1
 	    || camel_file_util_encode_uint32 (out, msi->mapi_folder_flags) == -1
-	    || camel_file_util_encode_string (out, msi->foreign_user_name ? msi->foreign_user_name : "") == -1
-	    || camel_file_util_encode_string (out, last_modified_str) == -1)
+	    || camel_file_util_encode_string (out, msi->foreign_user_name ? msi->foreign_user_name : "") == -1)
 		res = -1;
 	else
 		res = 0;
 
 	g_free (folder_id_str);
 	g_free (parent_id_str);
-	g_free (last_modified_str);
 
 	return res;
 }
@@ -249,8 +233,7 @@ camel_mapi_store_summary_add_from_full (CamelStoreSummary *s,
 					mapi_id_t parent_mid,
 					guint32 camel_folder_flags,
 					guint32 mapi_folder_flags,
-					const gchar *foreign_user_name,
-					time_t last_modified)
+					const gchar *foreign_user_name)
 {
 	CamelStoreInfo *si;
 
@@ -269,7 +252,6 @@ camel_mapi_store_summary_add_from_full (CamelStoreSummary *s,
 		msi->camel_folder_flags = camel_folder_flags;
 		msi->mapi_folder_flags = mapi_folder_flags;
 		msi->foreign_user_name = g_strdup ((foreign_user_name && *foreign_user_name) ? foreign_user_name : "");
-		msi->last_modified = last_modified;
 	}
 
 	return si;
diff --git a/src/camel/camel-mapi-store-summary.h b/src/camel/camel-mapi-store-summary.h
index d31984c..2124232 100644
--- a/src/camel/camel-mapi-store-summary.h
+++ b/src/camel/camel-mapi-store-summary.h
@@ -72,7 +72,6 @@ struct _CamelMapiStoreInfo {
 	guint32 camel_folder_flags; /* CamelFolderInfo::flags */
 	guint32 mapi_folder_flags; /* bit-or of CamelMapiStoreFolderFlags */
 	gchar *foreign_user_name; /* only if CAMEL_MAPI_STORE_FOLDER_FLAG_FOREIGN is set */
-	time_t last_modified; /* when was the folder last modified */
 };
 
 struct _CamelMapiStoreSummary {
@@ -92,8 +91,7 @@ CamelStoreInfo *	camel_mapi_store_summary_add_from_full	(CamelStoreSummary *s,
 								 mapi_id_t parent_mid,
 								 guint32 camel_folder_flags, /* CamelFolderInfo::flags */
 								 guint32 mapi_folder_flags, /* bit-or of CamelMapiStoreFolderFlags */
-								 const gchar *foreign_user_name, /* only if CAMEL_MAPI_STORE_FOLDER_FLAG_FOREIGN is set */
-								 time_t last_modified);
+								 const gchar *foreign_user_name); /* only if CAMEL_MAPI_STORE_FOLDER_FLAG_FOREIGN is set */
 CamelStoreInfo *	camel_mapi_store_summary_get_folder_id	(CamelStoreSummary *s,
 								 mapi_id_t folder_mid);
 
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index 6e4c8ee..dabc58f 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -485,8 +485,7 @@ mapi_folders_sync (CamelMapiStore *store, guint32 flags, GError **error)
 						info->flags,
 						folder->category == MAPI_PERSONAL_FOLDER ? CAMEL_MAPI_STORE_FOLDER_FLAG_PERSONAL:
 						CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC,
-						NULL,
-						folder->last_modified);
+						NULL);
 				if (msi == NULL)
 					continue;
 
@@ -516,8 +515,7 @@ mapi_folders_sync (CamelMapiStore *store, guint32 flags, GError **error)
 						e_mapi_folder_get_parent_id (folder),
 						info->flags,
 						CAMEL_MAPI_STORE_FOLDER_FLAG_PUBLIC,
-						NULL,
-						folder->last_modified);
+						NULL);
 
 				if (msi)
 					camel_store_summary_info_ref (store->summary, (CamelStoreInfo *) msi);
@@ -976,7 +974,8 @@ mapi_store_get_folder_info_sync (CamelStore *store,
 		   one every single question on the folder info */
 		if ((flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST) != 0 ||
 		    (!(flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED)) ||
-		    (top && *top && !camel_mapi_store_folder_id_lookup (mapi_store, top))) {
+		    (top && *top && !camel_mapi_store_folder_id_lookup (mapi_store, top)) ||
+		    camel_store_summary_count (mapi_store->summary) <= 1) {
 			CamelServiceConnectionStatus status;
 
 			status = camel_service_get_connection_status (service);
@@ -1076,8 +1075,7 @@ mapi_store_create_folder_sync (CamelStore *store,
 			parent_fid,
 			root->flags,
 			CAMEL_MAPI_STORE_FOLDER_FLAG_PERSONAL,
-			NULL,
-			0);
+			NULL);
 
 		camel_store_summary_save (mapi_store->summary);
 
diff --git a/src/libexchangemapi/e-mapi-connection.c b/src/libexchangemapi/e-mapi-connection.c
index b246258..30587b1 100644
--- a/src/libexchangemapi/e-mapi-connection.c
+++ b/src/libexchangemapi/e-mapi-connection.c
@@ -2373,7 +2373,7 @@ e_mapi_connection_create_folder (EMapiConnection *conn, uint32_t olFolder, mapi_
 	/* we should also update folder list locally */
 	if (fid != 0 && priv->folders != NULL) {
 		EMapiFolder *folder = NULL;
-		folder = e_mapi_folder_new (name, type, MAPI_PERSONAL_FOLDER, fid, pfid, 0, 0, 0, 0);
+		folder = e_mapi_folder_new (name, type, MAPI_PERSONAL_FOLDER, fid, pfid, 0, 0, 0);
 		if (folder)
 			priv->folders = g_slist_append (priv->folders, folder);
 	}
@@ -3353,7 +3353,7 @@ get_child_folders (TALLOC_CTX *mem_ctx, EMapiFolderCategory folder_hier, mapi_ob
 		goto cleanup;
 	}
 
-	SPropTagArray = set_SPropTagArray(mem_ctx, 9,
+	SPropTagArray = set_SPropTagArray(mem_ctx, 8,
 					  PR_FID,
 					  PR_PARENT_FID,
 					  PR_CONTAINER_CLASS,
@@ -3361,8 +3361,7 @@ get_child_folders (TALLOC_CTX *mem_ctx, EMapiFolderCategory folder_hier, mapi_ob
 					  PR_CONTENT_UNREAD,
 					  PR_CONTENT_COUNT,
 					  PR_MESSAGE_SIZE,
-					  PR_FOLDER_CHILD_COUNT,
-					  PR_LAST_MODIFICATION_TIME);
+					  PR_FOLDER_CHILD_COUNT);
 
 	ms = SetColumns (&obj_table, SPropTagArray);
 	if (ms != MAPI_E_SUCCESS) {
@@ -3403,16 +3402,6 @@ get_child_folders (TALLOC_CTX *mem_ctx, EMapiFolderCategory folder_hier, mapi_ob
 			const uint32_t *total = e_mapi_util_find_row_propval (&rowset.aRow[i], PR_CONTENT_COUNT);
 			const uint32_t *child = e_mapi_util_find_row_propval (&rowset.aRow[i], PR_FOLDER_CHILD_COUNT);
 			const uint32_t *folder_size = e_mapi_util_find_row_propval (&rowset.aRow[i], PR_MESSAGE_SIZE);
-			time_t last_modified;
-			struct SPropValue *last_modified_prop;
-			struct timeval t;
-
-			last_modified_prop = get_SPropValue_SRowSet (&rowset, PR_LAST_MODIFICATION_TIME);
-
-			if (last_modified_prop && get_mapi_SPropValue_date_timeval (&t, *last_modified_prop) == MAPI_E_SUCCESS)
-				last_modified = t.tv_sec;
-			else
-				last_modified = 0;
 
 			if (!klass)
 				klass = IPF_NOTE;
@@ -3421,7 +3410,7 @@ get_child_folders (TALLOC_CTX *mem_ctx, EMapiFolderCategory folder_hier, mapi_ob
 				name, klass, *fid, unread ? *unread : 0, total ? *total : 0, folder_size ? *folder_size : 0);
 
 			folder = e_mapi_folder_new (name, klass, folder_hier, *fid, pid ? *pid : folder_id,
-							   child ? *child : 0, unread ? *unread : 0, total ? *total : 0, last_modified);
+							   child ? *child : 0, unread ? *unread : 0, total ? *total : 0);
 
 			folder->size = folder_size ? *folder_size : 0;
 
@@ -3653,7 +3642,7 @@ e_mapi_connection_get_folders_list (EMapiConnection *conn, GSList **mapi_folders
 
 	/* FIXME: May have to get the child folders count? Do we need/use it? */
 	folder = e_mapi_folder_new (mailbox_name, IPF_NOTE,
-					   MAPI_PERSONAL_FOLDER, mailbox_id, 0, 0, 0 ,0, 0);
+					   MAPI_PERSONAL_FOLDER, mailbox_id, 0, 0, 0 ,0);
 	folder->is_default = true;
 	folder->default_type = olFolderTopInformationStore; /*Is this correct ?*/
 	folder->size = mailbox_size ? *mailbox_size : 0;
@@ -3708,7 +3697,7 @@ e_mapi_connection_get_pf_folders_list (EMapiConnection *conn, GSList **mapi_fold
 		goto cleanup;
 	}
 
-	folder = e_mapi_folder_new (_("All Public Folders"), IPF_NOTE, 0, mailbox_id, 0, 0, 0, 0, 0);
+	folder = e_mapi_folder_new (_("All Public Folders"), IPF_NOTE, 0, mailbox_id, 0, 0, 0, 0);
 	folder->is_default = true;
 	folder->default_type = olPublicFoldersAllPublicFolders;
 	*mapi_folders = g_slist_prepend (*mapi_folders, folder);
diff --git a/src/libexchangemapi/e-mapi-folder.c b/src/libexchangemapi/e-mapi-folder.c
index 30b1e17..babebfb 100644
--- a/src/libexchangemapi/e-mapi-folder.c
+++ b/src/libexchangemapi/e-mapi-folder.c
@@ -55,7 +55,7 @@ container_class_to_type (const gchar *type)
 }
 
 EMapiFolder *
-e_mapi_folder_new (const gchar *folder_name, const gchar *container_class, EMapiFolderCategory category, mapi_id_t folder_id, mapi_id_t parent_folder_id, uint32_t child_count, uint32_t unread_count, uint32_t total, time_t last_modified)
+e_mapi_folder_new (const gchar *folder_name, const gchar *container_class, EMapiFolderCategory category, mapi_id_t folder_id, mapi_id_t parent_folder_id, uint32_t child_count, uint32_t unread_count, uint32_t total)
 {
 	EMapiFolder *folder;
 
@@ -69,7 +69,6 @@ e_mapi_folder_new (const gchar *folder_name, const gchar *container_class, EMapi
 	folder->unread_count = unread_count;
 	folder->total = total;
 	folder->category = category;
-	folder->last_modified = last_modified;
 
 	return folder;
 }
diff --git a/src/libexchangemapi/e-mapi-folder.h b/src/libexchangemapi/e-mapi-folder.h
index 592ebb9..a0fa528 100644
--- a/src/libexchangemapi/e-mapi-folder.h
+++ b/src/libexchangemapi/e-mapi-folder.h
@@ -65,7 +65,6 @@ typedef struct _EMapiFolder {
 	guint32 unread_count;
 	guint32 total;
 	guint32 size;
-	time_t last_modified;
 
 	/* reserved */
 	gpointer reserved1;
@@ -80,8 +79,7 @@ EMapiFolder *		e_mapi_folder_new		(const gchar *folder_name,
 							 mapi_id_t parent_folder_id,
 							 uint32_t child_count,
 							 uint32_t unread_count,
-							 uint32_t total,
-							 time_t last_modified);
+							 uint32_t total);
 EMapiFolder *		e_mapi_folder_copy		(EMapiFolder *src);
 void			e_mapi_folder_free		(EMapiFolder *folder);
 EMapiFolderType		e_mapi_container_class		(gchar *type);



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