evolution-mapi r15 - in trunk/src: camel libexchangemapi



Author: msuman
Date: Mon Nov 24 14:55:32 2008
New Revision: 15
URL: http://svn.gnome.org/viewvc/evolution-mapi?rev=15&view=rev

Log:
Fixes for sending mails/meeting requests to recipients not in GAL.

Modified:
   trunk/src/camel/ChangeLog
   trunk/src/camel/camel-mapi-transport.c
   trunk/src/libexchangemapi/ChangeLog
   trunk/src/libexchangemapi/exchange-mapi-cal-utils.c
   trunk/src/libexchangemapi/exchange-mapi-connection.c

Modified: trunk/src/camel/camel-mapi-transport.c
==============================================================================
--- trunk/src/camel/camel-mapi-transport.c	(original)
+++ trunk/src/camel/camel-mapi-transport.c	Mon Nov 24 14:55:32 2008
@@ -421,13 +421,17 @@
 
 	/* this memory should be freed somewhere, perhaps in the existing
 	 * exchange_mapi_util_free_recipient_list() */
-	recipient->in.req_lpProps = g_new0 (struct SPropValue, 1);
-	recipient->in.req_cValues = 1;
+	recipient->in.req_lpProps = g_new0 (struct SPropValue, 2);
+	recipient->in.req_cValues = 2;
+
 	set_SPropValue_proptag (&(recipient->in.req_lpProps[0]), PR_RECIPIENT_TYPE, (const void *) &type);
 
+	val = 0;
+	set_SPropValue_proptag (&(recipient->in.req_lpProps[1]), PR_SEND_INTERNET_ENCODING, (const void *)&val);
+
 	/* External recipient properties - set them only when the recipient is unresolved */
-	recipient->in.ext_lpProps = g_new0 (struct SPropValue, 5);
-	recipient->in.ext_cValues = 5;
+	recipient->in.ext_lpProps = g_new0 (struct SPropValue, 7);
+	recipient->in.ext_cValues = 7;
 
 	val = DT_MAILUSER;
 	set_SPropValue_proptag (&(recipient->in.ext_lpProps[0]), PR_DISPLAY_TYPE, (const void *)&val);
@@ -437,7 +441,10 @@
 	set_SPropValue_proptag (&(recipient->in.ext_lpProps[2]), PR_ADDRTYPE, (const void *)(str));
 	str = recipient->email_id;
 	set_SPropValue_proptag (&(recipient->in.ext_lpProps[3]), PR_SMTP_ADDRESS, (const void *)(str));
-	set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_DISPLAY_NAME, (const void *)(str));
+	/* FIXME: Please add the correct names here instead of the e-mail ID */
+	set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_GIVEN_NAME, (const void *)(str));
+	set_SPropValue_proptag (&(recipient->in.ext_lpProps[5]), PR_DISPLAY_NAME, (const void *)(str));
+	set_SPropValue_proptag (&(recipient->in.ext_lpProps[6]), PR_7BIT_DISPLAY_NAME, (const void *)(str));
 
 	*recipient_list = g_slist_append (*recipient_list, recipient);
 }

Modified: trunk/src/libexchangemapi/exchange-mapi-cal-utils.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-cal-utils.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-cal-utils.c	Mon Nov 24 14:55:32 2008
@@ -382,13 +382,12 @@
 
 		param = icalproperty_get_first_parameter (att_prop, ICAL_CN_PARAMETER);
 		str = icalparameter_get_cn (param);
-		if (!(str && *str)) 
-			str = "";
+		str = (str) ? str : recipient->email_id;
 		set_SPropValue_proptag (&(recipient->in.req_lpProps[4]), PR_RECIPIENT_DISPLAY_NAME, (const void *)(str));
 
 		/* External recipient properties - set them only when the recipient is unresolved */
-		recipient->in.ext_lpProps = g_new0 (struct SPropValue, 5);
-		recipient->in.ext_cValues = 5;
+		recipient->in.ext_lpProps = g_new0 (struct SPropValue, 7);
+		recipient->in.ext_cValues = 7;
 
 		val = DT_MAILUSER;
 		set_SPropValue_proptag (&(recipient->in.ext_lpProps[0]), PR_DISPLAY_TYPE, (const void *)&val);
@@ -401,9 +400,10 @@
 
 		param = icalproperty_get_first_parameter (att_prop, ICAL_CN_PARAMETER);
 		str = icalparameter_get_cn (param);
-		if (!(str && *str)) 
-			str = "";
-		set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_DISPLAY_NAME, (const void *)(str));
+		str = (str) ? str : recipient->email_id;
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[4]), PR_GIVEN_NAME, (const void *)(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[5]), PR_DISPLAY_NAME, (const void *)(str));
+		set_SPropValue_proptag (&(recipient->in.ext_lpProps[6]), PR_7BIT_DISPLAY_NAME, (const void *)(str));
 
 		*recip_list = g_slist_append (*recip_list, recipient);
 

Modified: trunk/src/libexchangemapi/exchange-mapi-connection.c
==============================================================================
--- trunk/src/libexchangemapi/exchange-mapi-connection.c	(original)
+++ trunk/src/libexchangemapi/exchange-mapi-connection.c	Mon Nov 24 14:55:32 2008
@@ -85,7 +85,7 @@
 			g_print("\n%s(%d): %s: Already connected ", __FILE__, __LINE__, __PRETTY_FUNCTION__);
 		goto cleanup;
 	}
-	
+
 	if (profname)
 		profile = profname;
 	else {
@@ -760,58 +760,34 @@
 static void 
 set_recipient_properties (TALLOC_CTX *mem_ctx, struct SRow *aRow, ExchangeMAPIRecipient *recipient, gboolean is_external)
 {
-	struct SPropValue	SPropValue;
-	uint32_t		i;
+	uint32_t i;
 
 	if (is_external && recipient->in.ext_lpProps) {
-		const gchar		*dn = NULL;
-		const gchar		*email = NULL; 
+	/* FIXME: Setting PR_ENTRYID property seems to create problems for now. We should take 
+	 * another look at this after the CreateOneoffEntryId API is provided by LibMAPI. */
+#if 0
+		struct Binary_r *oneoff_eid;
+		struct SPropValue sprop; 
+		const gchar *dn = NULL, *email = NULL; 
 
-		/* retrieve dn and email */
-		dn = (const gchar *) get_SPropValue(recipient->in.ext_lpProps, PR_DISPLAY_NAME);
+		dn = (const gchar *) get_SPropValue (recipient->in.ext_lpProps, PR_DISPLAY_NAME);
 		dn = (dn) ? dn : "";
-
-		email = (const gchar *) get_SPropValue(recipient->in.ext_lpProps, PR_SMTP_ADDRESS);
+		email = (const gchar *) get_SPropValue (recipient->in.ext_lpProps, PR_SMTP_ADDRESS);
 		email = (email) ? email : "";
-
-		/* PR_OBJECT_TYPE */
-		SPropValue.ulPropTag = PR_OBJECT_TYPE;
-		SPropValue.value.l = MAPI_MAILUSER;
-		SRow_addprop(aRow, SPropValue);
-
-		/* PR_DISPLAY_TYPE */
-		SPropValue.ulPropTag = PR_DISPLAY_TYPE;
-		SPropValue.value.l = 0;
-		SRow_addprop(aRow, SPropValue);
-
-		/* PR_GIVEN_NAME */
-		SPropValue.ulPropTag = PR_GIVEN_NAME;
-		SPropValue.value.lpszA = dn;
-		SRow_addprop(aRow, SPropValue);
-
-		/* PR_DISPLAY_NAME */
-		SPropValue.ulPropTag = PR_DISPLAY_NAME;
-		SPropValue.value.lpszA = dn;
-		SRow_addprop(aRow, SPropValue);
-
-		/* PR_7BIT_DISPLAY_NAME */
-		SPropValue.ulPropTag = PR_7BIT_DISPLAY_NAME;
-		SPropValue.value.lpszA = dn;
-		SRow_addprop(aRow, SPropValue);
-		
-		/* PR_SMTP_ADDRESS */
-		SPropValue.ulPropTag = PR_SMTP_ADDRESS;
-		SPropValue.value.lpszA = email;
-		SRow_addprop(aRow, SPropValue);
-		
-		/* PR_ADDRTYPE */
-		SPropValue.ulPropTag = PR_ADDRTYPE;
-		SPropValue.value.lpszA = "SMTP";
-		SRow_addprop(aRow, SPropValue);
+		oneoff_eid = exchange_mapi_util_entryid_generate_oneoff (mem_ctx, dn, email, FALSE);
+		set_SPropValue_proptag (&sprop, PR_ENTRYID, (const void *)(oneoff_eid));
+		SRow_addprop (aRow, sprop);
+#endif
+
+	/* Now, add the properties which are specified for unresolved recipients alone. */
+		for (i = 0; i < recipient->in.ext_cValues; ++i)
+			SRow_addprop (aRow, recipient->in.ext_lpProps[i]);
 	}
 
-	/* FIXME: Temporary - I have not found where RecipClass is defined/used */
-	SetRecipientType(aRow, MAPI_TO);
+	/* Now, add the properties which are specified for each recipient
+	 * irrespective of whether it was resolved or not. */
+	for (i = 0; i < recipient->in.req_cValues; ++i)
+		SRow_addprop (aRow, recipient->in.req_lpProps[i]);
 }
 
 static void
@@ -821,7 +797,6 @@
 	struct SPropTagArray 	*SPropTagArray = NULL;
 	struct SRowSet 		*SRowSet = NULL;
 	struct SPropTagArray 	*FlagList = NULL;
-	struct SPropValue	SPropValue;
 	GSList 			*l;
 	const char 		**users = NULL;
 	uint32_t 		i, j, count = 0;
@@ -877,10 +852,6 @@
 		}
 	}
 
-	SPropValue.ulPropTag = PR_SEND_INTERNET_ENCODING;
-	SPropValue.value.l = 0;
-	SRowSet_propcpy(mem_ctx, SRowSet, SPropValue);
-
 	if (remove_existing) {
 		RemoveAllRecipients (obj_message);
 		if (retval != MAPI_E_SUCCESS) {



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