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



Author: jjohnny
Date: Thu Aug 21 11:07:19 2008
New Revision: 9417
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9417&view=rev

Log:
Preserve folder_type (fixme)


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-store-summary.h
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.c
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.h
   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	Thu Aug 21 11:07:19 2008
@@ -50,6 +50,7 @@
 static CamelOfflineFolderClass *parent_class = NULL;
 
 struct _CamelMapiFolderPrivate {
+	
 #ifdef ENABLE_THREADS
 	GStaticMutex search_lock;	/* for locking the search object */
 	GStaticRecMutex cache_lock;	/* for locking the cache object */
@@ -521,6 +522,9 @@
 	/*Get the New Items*/
 	if (!is_proxy) {
 		mapi_id_t temp_folder_id;
+		guint32 options = 0;
+		CamelFolderInfo *fi = NULL;
+
 		exchange_mapi_util_mapi_id_from_string (folder_id, &temp_folder_id);
 
 		if (!camel_mapi_store_connected (mapi_store, ex)) {
@@ -529,11 +533,15 @@
 			goto end2;
 		}
 
+		fi = camel_store_get_folder_info (folder->parent_store, folder->full_name, 0, NULL);
+		if (fi->flags & CAMEL_MAPI_FOLDER_PUBLIC)
+			options |= MAPI_OPTIONS_USE_PFSTORE;
+
 		status = exchange_mapi_connection_fetch_items  (temp_folder_id, NULL, 
 								summary_prop_list, G_N_ELEMENTS (summary_prop_list), 
 								NULL, NULL, 
 								fetch_items_cb, &item_list, 
-								0);
+								options);
 
 		if (!status) {
 			camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Fetch items failed"));
@@ -1019,14 +1027,21 @@
 	mapi_id_t id_folder;
 	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)
+		options |= MAPI_OPTIONS_USE_PFSTORE;
+
 	exchange_mapi_connection_fetch_item (id_folder, id_message, 
 					camel_GetPropsList, G_N_ELEMENTS (camel_GetPropsList), 
 					camel_build_name_id, NULL, 
 					fetch_item_cb, &item, 
-					MAPI_OPTIONS_FETCH_ALL | MAPI_OPTIONS_GETBESTBODY);
+					options);
 
 	if (item == NULL) {
 		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Could not get message"));

Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store-summary.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store-summary.h	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store-summary.h	Thu Aug 21 11:07:19 2008
@@ -74,29 +74,6 @@
 
 #define camel_mapi_store_info_full_name(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_STORE_INFO_LAST))
 
-/* --------------JUST FOR COMPILIING------------------------- */
-
-typedef struct {
-	CamelFolderInfo		fi;
-	char			*fid;
-	char			*file_name;
-} CamelOpenchangeFolderInfo;
-
-
-
-typedef struct {
-	CamelURL		*url;
-	CamelOpenchangeFolderInfo *fi;
-/* 	CamelStoreSummary	*summary; */
-	char			**fid;		/* contain the default_fid */
-	unsigned int		*fid_flags;	/* contain the default flags (index = index of summary->fid)*/
-	GPtrArray		*fi_array;	/* contain openchange_folder_info */
-	GHashTable		*fi_hash_fid;	/* key = char *folder_id */
- 	GHashTable		*fi_hash_name;	/* key = char *folder_full_name */
-	pthread_mutex_t		*mutex;		/* mutex using in internal */
-} ocStoreSummary_t;
-
-
 G_END_DECLS
 
 #endif /* ! _CAMEL_MAPI_STORE_SUMMARY_H */

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	Thu Aug 21 11:07:19 2008
@@ -903,6 +903,7 @@
 
 			fi->unread = si->unread;
 			fi->total = si->total;
+			fi->flags = si->flags;
 
 			g_ptr_array_add (folders, fi);
 		}
@@ -943,6 +944,10 @@
 	else if (!strcmp (name, "Junk Mail"))
 		fi->flags |= CAMEL_FOLDER_TYPE_JUNK;
 
+	if (folder->category == MAPI_PERSONAL_FOLDER)
+		fi->flags |= CAMEL_MAPI_FOLDER_PERSONAL;
+	else if (folder->category == MAPI_FAVOURITE_FOLDER)
+		fi->flags |= CAMEL_MAPI_FOLDER_PUBLIC;
 	/*
 	   parent_hash contains the "parent id <-> folder id" combination. So we form
 	   the path for the full name in camelfolder info by looking up the hash table until
@@ -995,7 +1000,7 @@
 
 	si->info.total = fi->total;
 	si->info.unread = fi->unread;
-	si->info.flags = 0;
+	si->info.flags = fi->flags;
 
 	return fi;
 }
@@ -1018,6 +1023,7 @@
 	CamelMapiStorePrivate  *priv = store->priv;
 	gboolean status;
 	GSList *folder_list = NULL, *temp_list = NULL, *list = NULL;
+	GSList *pf_folder_list = NULL;
 	char *url, *temp_url;
 	CamelFolderInfo *info = NULL, *hfi = NULL;
 	GHashTable *present;
@@ -1043,6 +1049,13 @@
 		return;
 	}
 
+	status = exchange_mapi_get_pf_folders_list (&folder_list);
+
+	if (!status) {
+		g_warning ("Could not get folder list..\n");
+		return;
+	}
+
 	temp_list = folder_list;
 	list = folder_list;
 
@@ -1063,12 +1076,10 @@
 		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)));
 
-		if (exchange_mapi_folder_is_root ((ExchangeMAPIFolder *)(temp_list->data)))
-			continue;
-
 		/*id_hash returns the name for a given container id*/
 		g_hash_table_insert (priv->id_hash, g_strdup (fid), g_strdup(name)); 
 

Modified: branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.h	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-store.h	Thu Aug 21 11:07:19 2008
@@ -34,6 +34,12 @@
 #define CAMEL_MAPI_STORE_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_MAPI_STORE_TYPE, CamelMapiStoreClass))
 #define CAMEL_IS_MAPI_STORE(o)    (CAMEL_CHECK_TYPE((o), CAMEL_MAPI_STORE_TYPE))
 
+/* 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)
 
 /**
  * definition of CamelMAPIStore

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	Thu Aug 21 11:07:19 2008
@@ -1108,9 +1108,10 @@
 	mapi_object_init(&obj_table);
 
 	/* 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;
 	}
 
@@ -1332,7 +1333,8 @@
 	mapi_object_init(&obj_message);
 
 	/* 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());
 		goto cleanup;
@@ -2781,6 +2783,7 @@
 	enum MAPISTATUS retval;
 	mapi_id_t id_mailbox;
 	gboolean result = FALSE;
+	ExchangeMAPIFolder *folder;
 
 	d(g_print("\n%s(%d): Entering %s ", __FILE__, __LINE__, __PRETTY_FUNCTION__));
 
@@ -2804,6 +2807,10 @@
 		goto cleanup;
 	}
 
+	/*  TODO : Localized string */
+	folder = exchange_mapi_folder_new ("Public Folders", NULL, IPF_NOTE, MAPI_FAVOURITE_FOLDER, id_mailbox, 0, 0, 0 ,0); 
+	*mapi_folders = g_slist_prepend (*mapi_folders, folder);
+
 	get_child_folders_pf(mem_ctx, &obj_store, id_mailbox, mapi_folders);
 
 	result = TRUE;

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	Thu Aug 21 11:07:19 2008
@@ -35,8 +35,9 @@
 	MAPI_OPTIONS_FETCH_BODY_STREAM = 1<<2,
 	MAPI_OPTIONS_FETCH_GENERIC_STREAMS = 1<<3, 
 	MAPI_OPTIONS_DONT_SUBMIT = 1<<4, 
-	MAPI_OPTIONS_GETBESTBODY = 1<<5
-} ExchangeMAPIOptions;
+	MAPI_OPTIONS_GETBESTBODY = 1<<5,
+	MAPI_OPTIONS_USE_PFSTORE = 1<<6
+} ExchangeMapiOptions;
 
 #define MAPI_OPTIONS_FETCH_ALL MAPI_OPTIONS_FETCH_ATTACHMENTS | \
 	                       MAPI_OPTIONS_FETCH_RECIPIENTS | \



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