evolution-data-server r9224 - branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi



Author: jjohnny
Date: Wed Jul 30 07:19:50 2008
New Revision: 9224
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9224&view=rev

Log:
cleanups in fetch items. gracefully fail when get_message fails.


Modified:
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/ChangeLog
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.c

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	Wed Jul 30 07:19:50 2008
@@ -703,12 +703,13 @@
 	const char *msg_class;
 	NTTIME ntdate;
 
-	MapiItem *item = data;
+	MapiItem *item = g_new0(MapiItem , 1);
+
+	MapiItem **i = (MapiItem **)data;
 
 	item->fid = fid;
 	item->mid = mid;
 
-	/* FixME : which on of this will fetch the subject. */
 	item->header.subject = g_strdup (exchange_mapi_util_find_array_propval (array, PR_NORMALIZED_SUBJECT));
 	item->header.to = g_strdup (exchange_mapi_util_find_array_propval (array, PR_DISPLAY_TO));
 	item->header.cc = g_strdup (exchange_mapi_util_find_array_propval (array, PR_DISPLAY_CC));
@@ -739,10 +740,10 @@
 	if ((*flags & MSGFLAG_HASATTACH) != 0)
 		item->header.flags |= CAMEL_MESSAGE_ATTACHMENTS;
 
-	//Fetch Attachments here.
-	printf("%s(%d):%s:Number of Attachments : %d \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, g_slist_length (attachments));
 	item->attachments = attachments;
 
+	*i = item;
+
 	return TRUE;
 }
 
@@ -982,7 +983,7 @@
 
 	mapi_id_t id_folder;
 	mapi_id_t id_message;
-	MapiItem *item = g_new0(MapiItem , 1);
+	MapiItem *item = NULL;
 
 	exchange_mapi_util_mapi_ids_from_uid (uid, &id_folder, &id_message);
 
@@ -990,7 +991,7 @@
 	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, 
+					fetch_item_cb, &item, 
 					MAPI_OPTIONS_FETCH_ALL);
 
 	if (item == NULL) {
@@ -1001,6 +1002,8 @@
 
 	msg = mapi_folder_item_to_msg (folder, item, ex);
 
+	g_free (item);
+
 	if (!msg) {
 		camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Could not get message"));
 		camel_message_info_free (&mi->info);
@@ -1008,9 +1011,6 @@
 		return NULL;
 	}
 
-/* 	if (msg) */
-/* 		camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-Source", mapi_base_url_lookup (priv)); */
-
 	/* add to cache */
 	CAMEL_MAPI_FOLDER_REC_LOCK (folder, cache_lock);
 	if ((cache_stream = camel_data_cache_add (mapi_folder->cache, "cache", uid, NULL))) {



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