[evolution-mapi] Bug #608408 - Folder -> Subscription doesn't show sub folders



commit 0cfebca5cd2219cb79597b42f5d38e50cded7df8
Author: punit <jpunit novell com>
Date:   Mon May 17 14:04:38 2010 +0200

    Bug #608408 - Folder -> Subscription doesn't show sub folders

 src/camel/camel-mapi-store.c                   |   26 +++++--------------
 src/libexchangemapi/exchange-mapi-connection.c |   31 ++++++-----------------
 src/libexchangemapi/exchange-mapi-connection.h |    2 +-
 3 files changed, 16 insertions(+), 43 deletions(-)
---
diff --git a/src/camel/camel-mapi-store.c b/src/camel/camel-mapi-store.c
index d255a30..1bf49cd 100644
--- a/src/camel/camel-mapi-store.c
+++ b/src/camel/camel-mapi-store.c
@@ -1365,7 +1365,7 @@ remove_path_from_store_summary (const gchar *path, gpointer value, CamelMapiStor
 }
 
 static void
-mapi_folders_sync (CamelMapiStore *store, const gchar *top, guint32 flags, CamelException *ex)
+mapi_folders_sync (CamelMapiStore *store, guint32 flags, CamelException *ex)
 {
 	CamelMapiStorePrivate  *priv = store->priv;
 	gboolean status;
@@ -1404,21 +1404,11 @@ mapi_folders_sync (CamelMapiStore *store, const gchar *top, guint32 flags, Camel
 	}
 
 	subscription_list = (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST);
-
 	if (subscription_list) {
 		/*Consult the name <-> fid hash table for a FID.*/
-		gchar *parent_id = NULL;
-		mapi_id_t pid = 0;
-
-		parent_id = (top) ? g_strdup (camel_mapi_store_folder_id_lookup_offline (store, top)) : NULL;
-		exchange_mapi_util_mapi_id_from_string (parent_id, &pid);
-
-		status = exchange_mapi_connection_get_pf_folders_list (priv->conn, &folder_list, pid);
-
+		status = exchange_mapi_connection_get_pf_folders_list (priv->conn, &folder_list);
 		if (!status)
 			g_warning ("Could not get Public folder list..\n");
-
-		g_free (parent_id);
 	}
 
 	temp_list = folder_list;
@@ -1427,8 +1417,7 @@ mapi_folders_sync (CamelMapiStore *store, const gchar *top, guint32 flags, Camel
 	url = camel_url_to_string (CAMEL_SERVICE(store)->url,
 				   (CAMEL_URL_HIDE_PASSWORD|
 				    CAMEL_URL_HIDE_PARAMS|
-				    CAMEL_URL_HIDE_AUTH) );
-
+				    CAMEL_URL_HIDE_AUTH));
 	if ( url[strlen(url) - 1] != '/') {
 		temp_url = g_strconcat (url, "/", NULL);
 		g_free ((gchar *)url);
@@ -1437,7 +1426,7 @@ mapi_folders_sync (CamelMapiStore *store, const gchar *top, guint32 flags, Camel
 
 	/*populate the hash table for finding the mapping from container id <-> folder name*/
 	for (;temp_list != NULL; temp_list = g_slist_next (temp_list) ) {
-		const gchar *full_name;
+		const gchar *full_name = NULL;
 		gchar *fid = NULL, *parent_id = NULL, *tmp = NULL;
 
 		fid = g_strdup_printf ("%016" G_GINT64_MODIFIER "X", exchange_mapi_folder_get_fid((ExchangeMAPIFolder *)(temp_list->data)));
@@ -1466,7 +1455,6 @@ mapi_folders_sync (CamelMapiStore *store, const gchar *top, guint32 flags, Camel
 			g_hash_table_insert (priv->default_folders, type,
 					     g_strdup(fid));
 		}
-
 		g_free (fid);
 		g_free (parent_id);
 		g_free (tmp);
@@ -1482,7 +1470,8 @@ mapi_folders_sync (CamelMapiStore *store, const gchar *top, guint32 flags, Camel
 			continue;
 
 		info = mapi_convert_to_folder_info (store, folder, (const gchar *)url, ex);
-		if (!(mapi_si = (CamelMapiStoreInfo *) camel_store_summary_path ((CamelStoreSummary *)store->summary, info->full_name))) {
+		mapi_si = (CamelMapiStoreInfo *) camel_store_summary_path ((CamelStoreSummary *)store->summary, info->full_name);
+		if (!mapi_si) {
 			gchar *fid, *pfid = NULL;
 
 			fid = g_strdup_printf ("%016" G_GINT64_MODIFIER "X",
@@ -1491,7 +1480,6 @@ mapi_folders_sync (CamelMapiStore *store, const gchar *top, guint32 flags, Camel
 						exchange_mapi_folder_get_parent_id((ExchangeMAPIFolder *)(folder_list->data)));
 
 			mapi_si = camel_mapi_store_summary_add_from_full (store->summary, info->full_name, '/', fid, pfid);
-
 			g_free (fid);
 			g_free (pfid);
 			if (mapi_si == NULL) {
@@ -1568,7 +1556,7 @@ mapi_get_folder_info(CamelStore *store, const gchar *top, guint32 flags, CamelEx
 	     (!mapi_store->priv->folders_synced) ||
 	     (top && *top && !camel_mapi_store_folder_id_lookup (mapi_store, top))) &&
 	    (check_for_connection ((CamelService *)store, ex) || ((CamelService *)store)->status == CAMEL_SERVICE_CONNECTING)) {
-		mapi_folders_sync (mapi_store, top, flags, ex);
+		mapi_folders_sync (mapi_store, flags, ex);
 
 		if (camel_exception_is_set (ex)) {
 			camel_service_unlock (CAMEL_SERVICE (store), CAMEL_SERVICE_REC_CONNECT_LOCK);
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index e047e7f..8ea32b5 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -26,6 +26,7 @@
 #include <config.h>
 #endif
 
+#include <glib/gi18n-lib.h>
 #include <camel/camel.h>
 
 #include "exchange-mapi-connection.h"
@@ -3079,14 +3080,13 @@ cleanup:
 }
 
 gboolean
-exchange_mapi_connection_get_pf_folders_list (ExchangeMapiConnection *conn, GSList **mapi_folders, mapi_id_t parent_fid)
+exchange_mapi_connection_get_pf_folders_list (ExchangeMapiConnection *conn, GSList **mapi_folders)
 {
 	enum MAPISTATUS		retval;
 	TALLOC_CTX		*mem_ctx;
 	gboolean		result = FALSE;
 	mapi_id_t		mailbox_id;
 	ExchangeMAPIFolder	*folder;
-	mapi_object_t obj_parent_folder;
 
 	CHECK_CORRECT_CONN_AND_GET_PRIV (conn, FALSE);
 	g_return_val_if_fail (priv->session != NULL, FALSE);
@@ -3099,34 +3099,19 @@ exchange_mapi_connection_get_pf_folders_list (ExchangeMapiConnection *conn, GSLi
 	if (!ensure_public_store (priv))
 		goto cleanup;
 
-	/* Open the folder if parent_fid is given. */
-	if (parent_fid) {
-		mapi_object_init(&obj_parent_folder);
-
-		retval = OpenFolder (&priv->public_store, parent_fid, &obj_parent_folder);
-		if (retval != MAPI_E_SUCCESS) {
-			mapi_errstr("OpenFolder", GetLastError());
-			goto cleanup;
-		}
-	} else {
-		retval = GetDefaultPublicFolder (&priv->public_store, &mailbox_id, olFolderPublicIPMSubtree);
+	retval = GetDefaultPublicFolder (&priv->public_store, &mailbox_id, olFolderPublicIPMSubtree);
 		if (retval != MAPI_E_SUCCESS) {
 			mapi_errstr("GetDefaultPublicFolder", GetLastError());
 			goto cleanup;
 		}
-	}
-	/*  TODO : Localized string */
-	folder = exchange_mapi_folder_new ("All Public Folders", IPF_NOTE, 0,
-					   mailbox_id, 0, 0, 0 ,0);
+
+	folder = exchange_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);
-
-	/* FIXME: check status of get_child_folders */
-	get_child_folders (mem_ctx, MAPI_FAVOURITE_FOLDER, parent_fid ? &obj_parent_folder : &priv->public_store,
-			   parent_fid ? parent_fid : mailbox_id, mapi_folders, 1);
-
+	get_child_folders (mem_ctx, MAPI_FAVOURITE_FOLDER, &priv->public_store,
+			   mailbox_id, mapi_folders, -1);
+	*mapi_folders = g_slist_reverse (*mapi_folders);
 	result = TRUE;
 
 cleanup:
diff --git a/src/libexchangemapi/exchange-mapi-connection.h b/src/libexchangemapi/exchange-mapi-connection.h
index 8ddd3b4..cfd3b41 100644
--- a/src/libexchangemapi/exchange-mapi-connection.h
+++ b/src/libexchangemapi/exchange-mapi-connection.h
@@ -197,7 +197,7 @@ gboolean		exchange_mapi_connection_remove_items (ExchangeMapiConnection *conn, u
 gboolean		exchange_mapi_connection_copy_items (ExchangeMapiConnection *conn, mapi_id_t src_fid, mapi_id_t dest_fid, GSList *mids);
 gboolean		exchange_mapi_connection_move_items (ExchangeMapiConnection *conn, mapi_id_t src_fid, mapi_id_t dest_fid, GSList *mids);
 gboolean 		exchange_mapi_connection_get_folders_list (ExchangeMapiConnection *conn, GSList **mapi_folders);
-gboolean		exchange_mapi_connection_get_pf_folders_list (ExchangeMapiConnection *conn, GSList **mapi_folders, mapi_id_t parent_id);
+gboolean		exchange_mapi_connection_get_pf_folders_list (ExchangeMapiConnection *conn, GSList **mapi_folders);
 GSList *		exchange_mapi_connection_peek_folders_list (ExchangeMapiConnection *conn);
 
 gboolean		exchange_mapi_connection_resolve_named_props (ExchangeMapiConnection *conn, mapi_id_t fid, ResolveNamedIDsData *named_ids_list, guint named_ids_n_elems);



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