evolution-data-server r8629 - branches/EXCHANGE_MAPI_BRANCH/servers/mapi



Author: msuman
Date: Mon Apr 14 12:27:04 2008
New Revision: 8629
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8629&view=rev

Log:
Unblocking all code which can now be used, since the switch to libmapi-0.7

Modified:
   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-utils.c
   branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-utils.h

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	Mon Apr 14 12:27:04 2008
@@ -41,8 +41,10 @@
 
 #define LOCK() 		g_message("%s(%d): %s: lock(connect_lock)", __FILE__, __LINE__, __PRETTY_FUNCTION__);g_static_rec_mutex_lock(&connect_lock)
 #define UNLOCK() 	g_message("%s(%d): %s: unlock(connect_lock)", __FILE__, __LINE__, __PRETTY_FUNCTION__);g_static_rec_mutex_unlock(&connect_lock)
-#define LOGALL() 	lp_set_cmdline(global_loadparm, "log level", "10"); global_mapi_ctx->dumpdata = TRUE;
-#define LOGNONE() 	lp_set_cmdline(global_loadparm, "log level", "0"); global_mapi_ctx->dumpdata = FALSE;
+//#define LOGALL() 	lp_set_cmdline(global_loadparm, "log level", "10"); global_mapi_ctx->dumpdata = TRUE;
+//#define LOGNONE() 	lp_set_cmdline(global_loadparm, "log level", "0"); global_mapi_ctx->dumpdata = FALSE;
+#define LOGALL()
+#define LOGNONE()
 #define ENABLE_VERBOSE_LOG() 	global_mapi_ctx->dumpdata = TRUE;
 
 /* Specifies READ/WRITE sizes to be used while handling attachment streams */
@@ -379,10 +381,6 @@
 	uint32_t		i_row_attach;
 	gboolean 		status = TRUE;
 
-	/* FIXME: remove this line once you upgrade to libmapi rev 327 or higher */
-	return TRUE;
-	/* also uncomment the line with the DeleteAttach call */
-
 	mem_ctx = talloc_init ("ExchangeMAPI_DeleteAttachments");
 
 	proptags = set_SPropTagArray(mem_ctx, 0x7, 
@@ -427,7 +425,7 @@
 
 		num_attach = (const uint32_t *) get_SPropValue_SRow_data(&rows_attach.aRow[i_row_attach], PR_ATTACH_NUM);
 
-//		retval = DeleteAttach(obj_message, *num_attach);
+		retval = DeleteAttach(obj_message, *num_attach);
 		if (retval != MAPI_E_SUCCESS) {
 			mapi_errstr("DeleteAttach", GetLastError());
 			goto loop_cleanup;
@@ -702,14 +700,10 @@
 	uint32_t		i_row_recip;
 	gboolean 		status = TRUE;
 
-	/* FIXME: remove this line once you upgrade to libmapi rev 340 or higher */
-	return TRUE;
-	/* also uncomment the line with the GetRecipientTable call */
-
 //	mem_ctx = talloc_init ("ExchangeMAPI_GetRecipients");
 
 	/* fetch recipient table */
-//	retval = GetRecipientTable(obj_message, &rows_recip, &proptags);
+	retval = GetRecipientTable(obj_message, &rows_recip, &proptags);
 	if (retval != MAPI_E_SUCCESS) {
 		mapi_errstr("GetRecipientTable", GetLastError());
 		goto cleanup;
@@ -720,11 +714,12 @@
 			ExchangeMAPIRecipient 	*recipient = g_new0 (ExchangeMAPIRecipient, 1);
 			const uint32_t *ui32;
 
+			recipient->email_id = (const char *) exchange_mapi_util_find_row_propval (&(rows_recip.aRow[i_row_recip]), PR_SMTP_ADDRESS);
+//			recipient->email_type = (const char *) exchange_mapi_util_find_row_propval (&(rows_recip.aRow[i_row_recip]), PR_RECIPIENT_);
 			/* FIXME: fallback on EX address type */
-			recipient->email_id = (const char *) find_SPropValue_data (&(rows_recip.aRow[i_row_recip]), PR_SMTP_ADDRESS_UNICODE);
 			recipient->email_type = "SMTP";
 			/* FIXME: fallback on other usable props */
-			recipient->name = (const char *) find_SPropValue_data(&rows_recip.aRow[i_row_recip], PR_RECIPIENT_DISPLAY_NAME_UNICODE);
+			recipient->name = (const char *) exchange_mapi_util_find_row_propval(&rows_recip.aRow[i_row_recip], PR_RECIPIENT_DISPLAY_NAME);
 			ui32 = (const uint32_t *) find_SPropValue_data(&rows_recip.aRow[i_row_recip], PR_RECIPIENTS_FLAGS);
 			recipient->flags = *ui32;
 			ui32 = (const uint32_t *) find_SPropValue_data(&rows_recip.aRow[i_row_recip], PR_RECIPIENT_TYPE);

Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-utils.c
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-utils.c	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-utils.c	Mon Apr 14 12:27:04 2008
@@ -229,3 +229,39 @@
 	l = NULL;
 }
 
+const gchar *
+exchange_mapi_util_ex_to_smtp (const gchar *ex_address)
+{
+	enum MAPISTATUS 	retval;
+	TALLOC_CTX 		*mem_ctx;
+	struct SPropTagArray	*SPropTagArray;
+	struct SRowSet 		*SRowSet = NULL;
+	struct FlagList		*flaglist = NULL;
+	const gchar 		*str_array[2];
+	const gchar 		*smtp_addr = NULL;
+
+	g_return_val_if_fail (ex_address != NULL, NULL);
+
+	str_array[0] = ex_address;
+	str_array[1] = NULL;
+
+	mem_ctx = talloc_init("ExchangeMAPI_EXtoSMTP");
+
+	SPropTagArray = set_SPropTagArray(mem_ctx, 0x2,
+					  PR_SMTP_ADDRESS,
+					  PR_SMTP_ADDRESS_UNICODE);
+
+	retval = ResolveNames((const char **)str_array, SPropTagArray, &SRowSet, &flaglist, 0);
+	if (retval != MAPI_E_SUCCESS)
+		retval = ResolveNames((const char **)str_array, SPropTagArray, &SRowSet, &flaglist, MAPI_UNICODE);
+
+	if (retval == MAPI_E_SUCCESS && SRowSet && SRowSet->cRows == 1) {
+		smtp_addr = (const char *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS);
+		if (!smtp_addr)
+			smtp_addr = (const char *) find_SPropValue_data(SRowSet->aRow, PR_SMTP_ADDRESS_UNICODE);
+	}
+
+	talloc_free (mem_ctx);
+
+	return smtp_addr;
+}

Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-utils.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-utils.h	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-utils.h	Mon Apr 14 12:27:04 2008
@@ -55,4 +55,7 @@
 void 
 exchange_mapi_util_free_stream_list (GSList **stream_list);
 
+const gchar *
+exchange_mapi_util_ex_to_smtp (const gchar *ex_address);
+
 #endif



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