evolution-data-server r9465 - in branches/EXCHANGE_MAPI_BRANCH: camel/providers/mapi servers/mapi



Author: jjohnny
Date: Tue Sep  2 04:53:11 2008
New Revision: 9465
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9465&view=rev

Log:
Use Folder to recognize the type rather than picking from folder_info eveytime.


Modified:
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/ChangeLog
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.h
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c
   branches/EXCHANGE_MAPI_BRANCH/servers/mapi/ChangeLog
   branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c
   branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.h

Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c	Tue Sep  2 04:53:11 2008
@@ -38,6 +38,7 @@
 #include <libmapi/libmapi.h>
 #include <exchange-mapi-defs.h>
 #include <exchange-mapi-utils.h>
+#include <exchange-mapi-folder.h>
 
 #include "camel-mapi-store.h"
 #include "camel-mapi-folder.h"
@@ -338,6 +339,7 @@
 	const char *folder_id;
 	mapi_id_t fid, deleted_items_fid;
 	int count, i;
+	guint32 options =0;
 
 	GSList *deleted_items, *deleted_head;
 	deleted_items = deleted_head = NULL;
@@ -348,6 +350,10 @@
 		return;
 	}
 
+	if (((CamelMapiFolder *)folder)->type == MAPI_FAVOURITE_FOLDER){
+		options |= MAPI_OPTIONS_USE_PFSTORE;
+	} 
+
 	folder_id =  camel_mapi_store_folder_id_lookup (mapi_store, folder->full_name) ;
 	exchange_mapi_util_mapi_id_from_string (folder_id, &fid);
 
@@ -420,7 +426,7 @@
 
 	if (read_items) {
 		CAMEL_SERVICE_REC_LOCK (mapi_store, connect_lock);
-		exchange_mapi_set_flags (0, fid, read_items, 0);
+		exchange_mapi_set_flags (0, fid, read_items, 0, options);
 		CAMEL_SERVICE_REC_UNLOCK (mapi_store, connect_lock);
 		g_slist_free (read_items);
 	}
@@ -533,9 +539,9 @@
 			goto end2;
 		}
 
-		fi = camel_store_get_folder_info (folder->parent_store, folder->full_name, 0, NULL);
-		if (fi->flags & CAMEL_MAPI_FOLDER_PUBLIC)
+		if (((CamelMapiFolder *)folder)->type == MAPI_FAVOURITE_FOLDER){
 			options |= MAPI_OPTIONS_USE_PFSTORE;
+		} 
 
 		status = exchange_mapi_connection_fetch_items  (temp_folder_id, NULL, 
 								summary_prop_list, G_N_ELEMENTS (summary_prop_list), 
@@ -1040,14 +1046,13 @@
 	mapi_id_t id_message;
 	MapiItem *item = NULL;
 	guint32 options = 0;
-	CamelFolderInfo *fi = NULL;
 
 	options = MAPI_OPTIONS_FETCH_ALL | MAPI_OPTIONS_GETBESTBODY ;
 	exchange_mapi_util_mapi_ids_from_uid (uid, &id_folder, &id_message);
 
-	fi = camel_store_get_folder_info (folder->parent_store, folder->full_name, 0, NULL);
-	if (fi->flags & CAMEL_MAPI_FOLDER_PUBLIC)
+	if (((CamelMapiFolder *)folder)->type == MAPI_FAVOURITE_FOLDER){
 		options |= MAPI_OPTIONS_USE_PFSTORE;
+	} 
 
 	exchange_mapi_connection_fetch_item (id_folder, id_message, 
 					camel_GetPropsList, G_N_ELEMENTS (camel_GetPropsList), 
@@ -1392,9 +1397,11 @@
 
 	CamelFolder	*folder = NULL;
 	CamelMapiFolder *mapi_folder;
+	CamelMapiStore  *mapi_store = (CamelMapiStore *) store;
+
 	char *summary_file, *state_file;
 	char *short_name;
-
+	guint32 i = 0;
 
 	folder = CAMEL_FOLDER (camel_object_new(camel_mapi_folder_get_type ()) );
 
@@ -1450,6 +1457,20 @@
 		return NULL;
 	}
 
+	for (i=0;i<camel_store_summary_count((CamelStoreSummary *)mapi_store->summary);i++) {
+		CamelStoreInfo *si = camel_store_summary_index((CamelStoreSummary *)mapi_store->summary, i);
+		if (si == NULL) 
+			continue;
+
+		if (!strcmp(folder_name, camel_mapi_store_info_full_name (mapi_store->summary, si))) {
+			if (si->flags & CAMEL_MAPI_FOLDER_PUBLIC)
+				mapi_folder->type = MAPI_FAVOURITE_FOLDER;
+			else if (si->flags & CAMEL_MAPI_FOLDER_PERSONAL)
+				mapi_folder->type = MAPI_PERSONAL_FOLDER;
+		}
+
+		camel_store_summary_info_free((CamelStoreSummary *)mapi_store->summary, si);
+	}
 	return folder;
 }
 

Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.h	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.h	Tue Sep  2 04:53:11 2008
@@ -100,6 +100,8 @@
 	CamelOfflineJournal *journal;
 	CamelDataCache *cache;
 
+	guint32 type;
+
 	unsigned int need_rescan:1;
 	unsigned int need_refresh:1;
 	unsigned int read_only:1;

Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c	Tue Sep  2 04:53:11 2008
@@ -64,9 +64,6 @@
 #include <libmapi/libmapi.h>
 #include <param.h>
 
-#define REACHED printf("%s(%d):%s:Reached \n", __FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define EXITING printf("%s(%d):%s:Exiting \n", __FILE__, __LINE__, __PRETTY_FUNCTION__)
-
 #define d(x) printf("%s(%d):%s:%s \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, x)
 
 struct _CamelMapiStorePrivate {
@@ -155,7 +152,6 @@
 CamelType 
 camel_mapi_store_get_type(void)
 {
-	REACHED;
 	static CamelType camel_mapi_store_type = CAMEL_INVALID_TYPE;
   
 	if (camel_mapi_store_type == CAMEL_INVALID_TYPE) {
@@ -331,7 +327,6 @@
 static gboolean
 mapi_connect(CamelService *service, CamelException *ex)
 {
-	REACHED;
 	CamelMapiStore *store = CAMEL_MAPI_STORE (service);
 	CamelMapiStorePrivate *priv = store->priv;
 
@@ -1021,7 +1016,6 @@
 static void
 mapi_folders_sync (CamelMapiStore *store, CamelException *ex)
 {
-	REACHED;
 	CamelMapiStorePrivate  *priv = store->priv;
 	gboolean status;
 	GSList *folder_list = NULL, *temp_list = NULL, *list = NULL;
@@ -1078,7 +1072,6 @@
 		gchar *fid = NULL, *parent_id = NULL;
 
 		name = exchange_mapi_folder_get_name ((ExchangeMAPIFolder *)(temp_list->data));
-		printf("%s(%d):%s:name : %s \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, name);
 		fid = g_strdup_printf ("%016llX", exchange_mapi_folder_get_fid((ExchangeMAPIFolder *)(temp_list->data)));
 		parent_id = g_strdup_printf ("%016llX", exchange_mapi_folder_get_parent_id ((ExchangeMAPIFolder *)(temp_list->data)));
 

Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.c	Tue Sep  2 04:53:11 2008
@@ -2152,7 +2152,7 @@
 }
 
 gboolean
-exchange_mapi_set_flags (uint32_t olFolder, mapi_id_t fid, GSList *mids, uint32_t flag)
+exchange_mapi_set_flags (uint32_t olFolder, mapi_id_t fid, GSList *mids, uint32_t flag, guint32 options)
 {
 	enum MAPISTATUS retval;
 	TALLOC_CTX *mem_ctx;
@@ -2176,9 +2176,10 @@
 		id_messages[i] = *((mapi_id_t *)tmp->data);
 
 	/* Open the message store */
-	retval = OpenMsgStore(&obj_store);
+	retval = ((options & MAPI_OPTIONS_USE_PFSTORE) ? OpenPublicFolder(&obj_store) : OpenMsgStore(&obj_store)) ;
+
 	if (retval != MAPI_E_SUCCESS) {
-		mapi_errstr("OpenMsgStore", GetLastError());
+		mapi_errstr("OpenMsgStore / OpenPublicFolder", GetLastError());
 		goto cleanup;
 	}
 

Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.h	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-connection.h	Tue Sep  2 04:53:11 2008
@@ -152,7 +152,7 @@
 			   uint32_t options);
 
 gboolean
-exchange_mapi_set_flags (uint32_t olFolder, mapi_id_t fid, GSList *mid_list, uint32_t flag);
+exchange_mapi_set_flags (uint32_t olFolder, mapi_id_t fid, GSList *mid_list, uint32_t flag, guint32 options);
 
 gboolean
 exchange_mapi_remove_items (uint32_t olFolder, mapi_id_t fid, GSList *mids);



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