[evolution-patches] Exchange : Folder size patch



Hi,

We were using the wrong property for fetching the folder size. Also, we
should not be scanning the subtree of the deleteditems folder. Both
these and a fix for a possible crash is included in this patch.

Please review.

Thanks
-- Sarfraaz
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.23
diff -u -p -u -p -r1.23 ChangeLog
--- ChangeLog	2 Aug 2005 13:09:54 -0000	1.23
+++ ChangeLog	12 Aug 2005 15:21:23 -0000
@@ -1,3 +1,11 @@
+2005-08-12  Sarfraaz Ahmed <asarfraaz novell com>
+
+	* storage/exchange-account.c (exchange_account_get_folder): Lookup on
+	NULL data is wrong. Handle it earlier.
+	* storage/exchange-hierarchy-webdav.c (rescan) : Use 
+	E2K_PR_EXCHANGE_FOLDER_SIZE for getting the folder size.
+	(scan_subtree): Similar. Also, dont scan the deleted items subtree.
+
 2005-08-02  Sarfraaz Ahmed <asarfraaz novell com>
 
 	* storage/exchange-hierarchy-favorites.c (remove_folder) : Remove
Index: storage/exchange-account.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-account.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 exchange-account.c
--- storage/exchange-account.c	2 Aug 2005 13:09:54 -0000	1.11
+++ storage/exchange-account.c	12 Aug 2005 15:21:24 -0000
@@ -1810,6 +1810,9 @@ exchange_account_get_folder (ExchangeAcc
 {
 	g_return_val_if_fail (EXCHANGE_IS_ACCOUNT (account), NULL);
 
+	if (!path_or_uri)
+		return NULL;
+
 	return g_hash_table_lookup (account->priv->folders, path_or_uri);
 }
 
Index: storage/exchange-hierarchy-webdav.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/storage/exchange-hierarchy-webdav.c,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 exchange-hierarchy-webdav.c
--- storage/exchange-hierarchy-webdav.c	21 Jul 2005 14:45:57 -0000	1.4
+++ storage/exchange-hierarchy-webdav.c	12 Aug 2005 15:21:24 -0000
@@ -488,7 +488,7 @@ add_href (gpointer path, gpointer folder
 
 /* E2K_PR_EXCHANGE_FOLDER_SIZE also can be used for reading folder size */
 static const char *rescan_props[] = {
-	PR_MESSAGE_SIZE_EXTENDED,
+	E2K_PR_EXCHANGE_FOLDER_SIZE,
 	E2K_PR_HTTPMAIL_UNREAD_COUNT
 };
 static const int n_rescan_props = sizeof (rescan_props) / sizeof (rescan_props[0]);
@@ -543,7 +543,8 @@ rescan (ExchangeHierarchy *hier)
 			e_folder_set_unread_count (folder, unread);
 
 		folder_size = e2k_properties_get_prop (result->props,
-						PR_MESSAGE_SIZE_EXTENDED);
+				E2K_PR_EXCHANGE_FOLDER_SIZE);
+
 		if (folder_size) {
 			folder_name = e_folder_get_name (folder);
 			fsize_d = g_ascii_strtod (folder_size, NULL)/1024;
@@ -670,7 +671,7 @@ static const char *folder_props[] = {
 	E2K_PR_HTTPMAIL_UNREAD_COUNT,
 	E2K_PR_DAV_DISPLAY_NAME,
 	E2K_PR_EXCHANGE_PERMANENTURL,
-	PR_MESSAGE_SIZE_EXTENDED,
+	E2K_PR_EXCHANGE_FOLDER_SIZE,
 	E2K_PR_DAV_HAS_SUBS
 };
 static const int n_folder_props = sizeof (folder_props) / sizeof (folder_props[0]);
@@ -688,7 +689,7 @@ scan_subtree (ExchangeHierarchy *hier, E
 	GPtrArray *folders;
 	int i;
 	gdouble fsize_d;
-	const char *name, *folder_size;
+	const char *name, *folder_size, *deleted_items_uri, *int_uri;
 	gboolean personal = ( EXCHANGE_HIERARCHY (hwd)->type == EXCHANGE_HIERARCHY_PERSONAL );
 
 	if (offline) {
@@ -730,7 +731,7 @@ scan_subtree (ExchangeHierarchy *hier, E
 		name = e2k_properties_get_prop (result->props,
 							E2K_PR_DAV_DISPLAY_NAME);
 		folder_size = e2k_properties_get_prop (result->props,
-							PR_MESSAGE_SIZE_EXTENDED);
+				E2K_PR_EXCHANGE_FOLDER_SIZE);
 
 		/* FIXME : Find a better way of doing this */
 		fsize_d = g_ascii_strtod (folder_size, NULL)/1024 ;
@@ -743,9 +744,15 @@ scan_subtree (ExchangeHierarchy *hier, E
 	}
 	status = e2k_result_iter_free (iter);
 
+	deleted_items_uri = exchange_account_get_standard_uri (hier->account, "deleteditems");
+
 	while (subtrees) {
 		folder = subtrees->data;
 		subtrees = g_slist_remove (subtrees, folder);
+		/* Dont scan the subtree for deleteditems folder */
+		int_uri = e_folder_exchange_get_internal_uri (folder);
+		if (int_uri && !strcmp (int_uri, deleted_items_uri))
+			continue;
 		scan_subtree (hier, folder, offline);
 	}
 


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