evolution-data-server r8512 - in branches/EXCHANGE_MAPI_BRANCH: addressbook/backends/mapi calendar/backends/mapi servers/mapi



Author: msuman
Date: Wed Feb 20 07:20:44 2008
New Revision: 8512
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8512&view=rev

Log:
Re-named build_props and build_name_id for respective backends, so they don't incorrectly link. Added a new param to ExchangeMAPIRecipient. Recipent list, attachment list and stream list *should* be freed by the caller.

Modified:
   branches/EXCHANGE_MAPI_BRANCH/addressbook/backends/mapi/ChangeLog
   branches/EXCHANGE_MAPI_BRANCH/addressbook/backends/mapi/e-book-backend-mapi.c
   branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/ChangeLog
   branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.c
   branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.h
   branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi.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/addressbook/backends/mapi/e-book-backend-mapi.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/addressbook/backends/mapi/e-book-backend-mapi.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/addressbook/backends/mapi/e-book-backend-mapi.c	Wed Feb 20 07:20:44 2008
@@ -341,7 +341,7 @@
 }
 
 gboolean
-build_name_id (struct mapi_nameid *nameid, gpointer data)
+mapi_book_build_name_id (struct mapi_nameid *nameid, gpointer data)
 {
 	EContact *contact = data;
 	
@@ -375,7 +375,7 @@
 #define set_str_value(field_id, hex) if (e_contact_get (contact, field_id)) set_SPropValue_proptag (&props[i++], hex, e_contact_get (contact, field_id));
 
 int
-build_props (struct SPropValue ** value, struct SPropTagArray * SPropTagArray, gpointer data)
+mapi_book_build_props (struct SPropValue ** value, struct SPropTagArray * SPropTagArray, gpointer data)
 {
 	EContact *contact = data;	
 	int len = -1;
@@ -534,7 +534,7 @@
 	   
 	case  GNOME_Evolution_Addressbook_MODE_REMOTE :
 		contact = e_contact_new_from_vcard(vcard);
-		status = exchange_mapi_create_item (olFolderContacts, priv->fid, build_name_id, contact, build_props, contact, NULL, NULL);
+		status = exchange_mapi_create_item (olFolderContacts, priv->fid, mapi_book_build_name_id, contact, mapi_book_build_props, contact, NULL, NULL);
 		if (!status) {
 			e_data_book_respond_create(book, opid, GNOME_Evolution_Addressbook_OtherError, NULL);
 			return;
@@ -642,7 +642,7 @@
 		exchange_mapi_util_mapi_ids_from_uid (tmp, &fid, &mid);		
 		printf("modify id %s\n", tmp);
 		
-		status = exchange_mapi_modify_item (olFolderContacts, priv->fid, mid, build_name_id, contact, build_props, contact, NULL, NULL);
+		status = exchange_mapi_modify_item (olFolderContacts, priv->fid, mid, mapi_book_build_name_id, contact, mapi_book_build_props, contact, NULL, NULL);
 		printf("getting %016llX\n", status);
 		if (!status) {
 			e_data_book_respond_modify(book, opid, GNOME_Evolution_Addressbook_OtherError, NULL);
@@ -820,7 +820,7 @@
 static const uint16_t n_GetPropsList = G_N_ELEMENTS (GetPropsList);
 
 gboolean
-build_name_id_for_getprops (struct mapi_nameid *nameid, gpointer data)
+mapi_book_build_name_id_for_getprops (struct mapi_nameid *nameid, gpointer data)
 {
 	mapi_nameid_lid_add(nameid, 0x8084, PSETID_Address); /* PT_STRING8 - EmailOriginalDisplayName */
 //	mapi_nameid_lid_add(nameid, 0x8020, PSETID_Address);
@@ -897,7 +897,7 @@
 			}
 
 			if (!exchange_mapi_connection_fetch_items (priv->fid, 
-								GetPropsList, n_GetPropsList, build_name_id_for_getprops, 
+								GetPropsList, n_GetPropsList, mapi_book_build_name_id_for_getprops, 
 								   &res, create_contact_list_cb, &vcard_str, MAPI_OPTIONS_FETCH_ALL)) {
 				e_data_book_respond_get_contact_list (book, opid, GNOME_Evolution_Addressbook_OtherError, NULL);
 				return ;

Modified: branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.c	Wed Feb 20 07:20:44 2008
@@ -550,7 +550,7 @@
 } CommonNamedPropsIndex;
 
 gboolean
-build_name_id (struct mapi_nameid *nameid, gpointer data)
+mapi_cal_build_name_id (struct mapi_nameid *nameid, gpointer data)
 {
 	ECalBackendMAPI *cbmapi	= E_CAL_BACKEND_MAPI (data);
 	icalcomponent_kind kind = e_cal_backend_get_kind (E_CAL_BACKEND (cbmapi));
@@ -740,7 +740,7 @@
  * should be updated. 
  */
 int
-build_props (struct SPropValue **value, struct SPropTagArray *proptag_array, gpointer data)
+mapi_cal_build_props (struct SPropValue **value, struct SPropTagArray *proptag_array, gpointer data)
 {
 	ECalComponent *comp = E_CAL_COMPONENT (data);
 	icalcomponent *ical_comp = e_cal_component_get_icalcomponent (comp);

Modified: branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.h	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi-utils.h	Wed Feb 20 07:20:44 2008
@@ -37,10 +37,10 @@
 				  GSList *streams, GSList *recipients, GSList *attachments, const icaltimezone *default_zone);
 
 gboolean
-build_name_id (struct mapi_nameid *nameid, gpointer data);
+mapi_cal_build_name_id (struct mapi_nameid *nameid, gpointer data);
 
 int
-build_props (struct SPropValue **value, struct SPropTagArray *proptag_array, gpointer data);
+mapi_cal_build_props (struct SPropValue **value, struct SPropTagArray *proptag_array, gpointer data);
 
 void
 e_cal_backend_mapi_util_dump_properties (struct mapi_SPropValue_array *properties);

Modified: branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/calendar/backends/mapi/e-cal-backend-mapi.c	Wed Feb 20 07:20:44 2008
@@ -491,7 +491,7 @@
 	priv->cache_keys = e_cal_backend_cache_get_keys (cache);
 
 //	e_file_cache_freeze_changes (E_FILE_CACHE (cache));
-	if (!exchange_mapi_connection_fetch_items (priv->fid, GetPropsList, n_GetPropsList, build_name_id, NULL, get_changes_cb, cbmapi, MAPI_OPTIONS_FETCH_ALL)) {
+	if (!exchange_mapi_connection_fetch_items (priv->fid, GetPropsList, n_GetPropsList, mapi_cal_build_name_id, NULL, get_changes_cb, cbmapi, MAPI_OPTIONS_FETCH_ALL)) {
 		e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Could not create cache file"));
 		e_file_cache_thaw_changes (E_FILE_CACHE (cache));
 		priv->cache_keys = NULL;
@@ -924,7 +924,7 @@
 	e_cal_backend_notify_view_progress (E_CAL_BACKEND (cbmapi), progress_string, 99);
 
 //	e_file_cache_freeze_changes (E_FILE_CACHE (priv->cache));
-	if (!exchange_mapi_connection_fetch_items (priv->fid, GetPropsList, n_GetPropsList, build_name_id, NULL, cache_create_cb, cbmapi, MAPI_OPTIONS_FETCH_ALL)) {
+	if (!exchange_mapi_connection_fetch_items (priv->fid, GetPropsList, n_GetPropsList, mapi_cal_build_name_id, NULL, cache_create_cb, cbmapi, MAPI_OPTIONS_FETCH_ALL)) {
 		e_cal_backend_notify_error (E_CAL_BACKEND (cbmapi), _("Could not create cache file"));
 		e_file_cache_thaw_changes (E_FILE_CACHE (priv->cache));
 		g_free (progress_string);
@@ -1250,7 +1250,7 @@
 		case CAL_MODE_ANY:
 		case CAL_MODE_REMOTE:
 			/* Create an appointment */
-			mid = exchange_mapi_create_item (priv->olFolder, priv->fid, build_name_id, cbmapi, build_props, comp, NULL, attachments);
+			mid = exchange_mapi_create_item (priv->olFolder, priv->fid, mapi_cal_build_name_id, cbmapi, mapi_cal_build_props, comp, NULL, attachments);
 			if (!mid) {
 				g_object_unref (comp);
 				exchange_mapi_util_free_attachment_list (&attachments);
@@ -1339,7 +1339,7 @@
 			return GNOME_Evolution_Calendar_ObjectNotFound;
 		}
 		exchange_mapi_util_mapi_id_from_string (uid, &mid);
-		status = exchange_mapi_modify_item (priv->olFolder, priv->fid, mid, build_name_id, cbmapi, build_props, comp, NULL, NULL);
+		status = exchange_mapi_modify_item (priv->olFolder, priv->fid, mid, mapi_cal_build_name_id, cbmapi, mapi_cal_build_props, comp, NULL, NULL);
 		if (!status) {
 			g_object_unref (comp);
 			g_object_unref (cache_comp);

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	Wed Feb 20 07:20:44 2008
@@ -306,8 +306,9 @@
 			else if ((data = (const char *) find_SPropValue_data (&aRow, PR_BODY_UNICODE)) != NULL)
 				proptag = PR_BODY_UNICODE;
 			if (data) {
-				body.data = talloc_memdup(mem_ctx, data, strlen(data));
-				body.length = strlen(data);
+				size_t size = strlen(data)+1;
+				body.data = talloc_memdup(mem_ctx, data, size);
+				body.length = size;
 				retval = MAPI_E_SUCCESS;
 			} 
 			break;
@@ -317,8 +318,9 @@
 			else if ((data = (const char *) find_SPropValue_data (&aRow, PR_BODY_HTML_UNICODE)) != NULL)
 				proptag = PR_BODY_HTML_UNICODE;
 			if (data) {
-				body.data = talloc_memdup(mem_ctx, data, strlen(data));
-				body.length = strlen(data);
+				size_t size = strlen(data)+1;
+				body.data = talloc_memdup(mem_ctx, data, size);
+				body.length = size;
 				retval = MAPI_E_SUCCESS;
 			} else if (exchange_mapi_util_read_generic_stream (obj_message, PR_HTML, stream_list)) {
 				retval = MAPI_E_SUCCESS;
@@ -727,6 +729,8 @@
 			recipient->flags = *ui32;
 			ui32 = (const uint32_t *) find_SPropValue_data(&rows_recip.aRow[i_row_recip], PR_RECIPIENT_TYPE);
 			recipient->type = *ui32;
+			ui32 = (const uint32_t *) find_SPropValue_data(&rows_recip.aRow[i_row_recip], PR_RECIPIENT_TRACKSTATUS);
+			recipient->trackstatus = *ui32;
 
 			*recip_list = g_slist_append (*recip_list, recipient);
 		}
@@ -900,7 +904,7 @@
 			exchange_mapi_util_get_attachments (&obj_message, &attach_list);
 		}
 
-		if ( options & MAPI_OPTIONS_FETCH_RECIPIENTS) 
+		if (options & MAPI_OPTIONS_FETCH_RECIPIENTS) 
 			exchange_mapi_util_get_recipients (&obj_message, &recip_list);
 
 		/* get the main body stream no matter what */
@@ -936,6 +940,7 @@
 
 			mapi_SPropValue_array_named(&obj_message, &properties_array);
 
+			/* NOTE: stream_list, recipient_list and attach_list should be freed by the callback */
 			if (!cb (&properties_array, *pfid, *pmid, stream_list, recip_list, attach_list, data)) {
 				g_warning ("%s(%d): %s: Callback failed for message-id %016llX \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, *pmid);
 			}
@@ -946,16 +951,6 @@
 
 	loop_cleanup:
 		mapi_object_release(&obj_message);
-
-		/* FIXME : Should be freed by the caller */
-/* 		if (attach_list) */
-/* 			exchange_mapi_util_free_attachment_list (&attach_list); */
-
-		if (recip_list) 
-			exchange_mapi_util_free_recipient_list (&recip_list);
-
-		if (stream_list) 
-			exchange_mapi_util_free_stream_list (&stream_list);
 	}
 
 	result = TRUE;
@@ -1098,22 +1093,13 @@
 
 		mapi_SPropValue_array_named(&obj_message, &properties_array);
 
+		/* NOTE: stream_list, recipient_list and attach_list should be freed by the callback */
 		retobj = cb (&properties_array, fid, mid, stream_list, recip_list, attach_list);
 	}
 
 //	if (GetPropsTagArray->cValues) 
 //		talloc_free (properties_array.lpProps);
 
-	/* should I ?? */
-/* 	if (attach_list) */
-/* 		exchange_mapi_util_free_attachment_list (&attach_list); */
-
-	if (recip_list) 
-		exchange_mapi_util_free_recipient_list (&recip_list);
-
-	if (stream_list) 
-		exchange_mapi_util_free_stream_list (&stream_list);
-
 cleanup:
 	mapi_object_release(&obj_message);
 	mapi_object_release(&obj_folder);

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	Wed Feb 20 07:20:44 2008
@@ -66,6 +66,7 @@
 	const char *email_id;
 	const char *email_type;
 	const char *name;
+	uint32_t trackstatus;
 	guint32 flags;
 	ExchangeMAPIRecipientType type;
 } ExchangeMAPIRecipient;



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