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



Author: msuman
Date: Wed Aug 27 07:53:26 2008
New Revision: 9439
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9439&view=rev

Log:
Minor fixes, code cleanups.

Modified:
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/ChangeLog
   branches/EXCHANGE_MAPI_BRANCH/camel/providers/mapi/camel-mapi-folder.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-utils.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 Aug 27 07:53:26 2008
@@ -591,6 +591,8 @@
 
 	PR_BODY, 
 	PR_BODY_UNICODE, 
+	PR_BODY_HTML, 
+	PR_BODY_HTML_UNICODE, 
 
 	PR_DISPLAY_TO, 
 	PR_DISPLAY_TO_UNICODE, 
@@ -645,7 +647,7 @@
 
 	mapi_nameid_lid_add(nameid, 0x8201, PSETID_Appointment); 	// PT_LONG - ApptSequence
 	mapi_nameid_lid_add(nameid, 0x8205, PSETID_Appointment); 	// PT_LONG - BusyStatus
-	mapi_nameid_lid_add(nameid, 0x8208, PSETID_Appointment); 	// PT_STRING8 - Location
+	mapi_nameid_lid_add(nameid, 0x8208, PSETID_Appointment); 	// PT_UNICODE - Location
 	mapi_nameid_lid_add(nameid, 0x820D, PSETID_Appointment); 	// PT_SYSTIME - Start/ApptStartWhole
 	mapi_nameid_lid_add(nameid, 0x820E, PSETID_Appointment); 	// PT_SYSTIME - End/ApptEndWhole
 	mapi_nameid_lid_add(nameid, 0x8213, PSETID_Appointment); 	// PT_LONG - Duration/ApptDuration
@@ -667,7 +669,7 @@
 	mapi_nameid_lid_add(nameid, 0x825E, PSETID_Appointment); 	// PT_BINARY - (timezone for dtstart)
 	mapi_nameid_lid_add(nameid, 0x825F, PSETID_Appointment); 	// PT_BINARY - (timezone for dtend)
 
-	mapi_nameid_lid_add(nameid, 0x0002, PSETID_Meeting); 		// PT_STRING8 - Where
+	mapi_nameid_lid_add(nameid, 0x0002, PSETID_Meeting); 		// PT_UNICODE - Where
 	mapi_nameid_lid_add(nameid, 0x0003, PSETID_Meeting); 		// PT_BINARY - GlobalObjectId
 	mapi_nameid_lid_add(nameid, 0x0005, PSETID_Meeting); 		// PT_BOOLEAN - IsRecurring
 	mapi_nameid_lid_add(nameid, 0x000a, PSETID_Meeting); 		// PT_BOOLEAN - IsException 

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 Aug 27 07:53:26 2008
@@ -244,15 +244,11 @@
 	TALLOC_CTX 			*mem_ctx;
 	struct SPropTagArray		*SPropTagArray;
 	struct SPropValue		*lpProps;
-	struct SRow			aRow;
 	uint32_t			count;
-	/* common email fields */
 	DATA_BLOB			body;
 	uint8_t 			editor;
-	mapi_object_t			obj_stream;
 	const char			*data = NULL;
 	const bool 			*rtf_in_sync;
-	const uint32_t 			*ui32 = NULL;
 	uint32_t 			proptag = 0;
 
 	/* sanity check */
@@ -282,11 +278,6 @@
 		return FALSE;
 	}
 
-	/* Build a SRow structure */
-	aRow.ulAdrEntryPad = 0;
-	aRow.cValues = count;
-	aRow.lpProps = lpProps;
-
 	if (getbestbody) {
 		/* Use BestBody Algo */
 		retval = GetBestBody(obj_message, &editor);
@@ -300,7 +291,7 @@
 		if (editor != olEditorText && editor != olEditorHTML) 
 			editor = olEditorHTML;
 	} else {
-		ui32 = (const uint32_t *) find_SPropValue_data(&aRow, PR_MSG_EDITOR_FORMAT);
+		const uint32_t *ui32 = (const uint32_t *) get_SPropValue(lpProps, PR_MSG_EDITOR_FORMAT);
 		/* if PR_MSG_EDITOR_FORMAT doesn't exist, set it to PLAINTEXT */
 		editor = ui32 ? *ui32 : olEditorText;
 	}
@@ -312,9 +303,9 @@
 	retval = -1;
 	switch (editor) {
 		case olEditorText:
-			if ((data = (const char *) find_SPropValue_data (&aRow, PR_BODY_UNICODE)) != NULL)
+			if ((data = (const char *) get_SPropValue (lpProps, PR_BODY_UNICODE)) != NULL)
 				proptag = PR_BODY_UNICODE;
-			else if ((data = (const char *) find_SPropValue_data (&aRow, PR_BODY)) != NULL)
+			else if ((data = (const char *) get_SPropValue (lpProps, PR_BODY)) != NULL)
 				proptag = PR_BODY;
 			if (data) {
 				size_t size = strlen(data)+1;
@@ -324,9 +315,9 @@
 			} 
 			break;
 		case olEditorHTML: 
-			if ((data = (const char *) find_SPropValue_data (&aRow, PR_BODY_HTML_UNICODE)) != NULL)
+			if ((data = (const char *) get_SPropValue (lpProps, PR_BODY_HTML_UNICODE)) != NULL)
 				proptag = PR_BODY_HTML_UNICODE;
-			else if ((data = (const char *) find_SPropValue_data (&aRow, PR_BODY_HTML)) != NULL)
+			else if ((data = (const char *) get_SPropValue (lpProps, PR_BODY_HTML)) != NULL)
 				proptag = PR_BODY_HTML;
 			if (data) {
 				size_t size = strlen(data)+1;
@@ -338,8 +329,11 @@
 			}
 			break;
 		case olEditorRTF: 
-			rtf_in_sync = (const bool *)find_SPropValue_data (&aRow, PR_RTF_IN_SYNC);
-//			if (!(rtf_in_sync && *rtf_in_sync)) {
+			rtf_in_sync = (const bool *) get_SPropValue (lpProps, PR_RTF_IN_SYNC);
+//			if (!(rtf_in_sync && *rtf_in_sync))
+			{
+				mapi_object_t obj_stream;
+
 				mapi_object_init(&obj_stream);
 
 				retval = OpenStream(obj_message, PR_RTF_COMPRESSED, STREAM_ACCESS_READ, &obj_stream);
@@ -350,13 +344,16 @@
 				}
 
 				retval = WrapCompressedRTFStream(&obj_stream, &body);
-				if (retval != MAPI_E_SUCCESS)
+				if (retval != MAPI_E_SUCCESS) {
 					mapi_errstr("WrapCompressedRTFStream", GetLastError());
+					mapi_object_release(&obj_stream);
+					break;
+				}
 
 				proptag = PR_RTF_COMPRESSED;
 
 				mapi_object_release(&obj_stream);
-//			}
+			}
 			break;
 		default: 
 			break;

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	Wed Aug 27 07:53:26 2008
@@ -338,13 +338,14 @@
 			struct mapi_SPropValue *lpProp = &properties->lpProps[i];
 			const char *tmp =  get_proptag_name (lpProp->ulPropTag);
 			char t_str[26];
+			gint j = 0;
 			if (tmp && *tmp)
 				g_print("\n%s \t",tmp);
 			else
-				g_print("\n%x \t", lpProp->ulPropTag);
+				g_print("\n0x%08X \t", lpProp->ulPropTag);
 			switch(lpProp->ulPropTag & 0xFFFF) {
 			case PT_BOOLEAN:
-				g_print(" (bool) - %d", lpProp->value.b);
+				g_print(" (bool) - %d", (bool) lpProp->value.b);
 				break;
 			case PT_I2:
 				g_print(" (uint16_t) - %d", lpProp->value.i);
@@ -356,28 +357,32 @@
 				g_print (" (double) -  %lf", (double)lpProp->value.dbl);
 				break;
 			case PT_I8:
-				g_print (" (int) - %ld", lpProp->value.d);
+				g_print (" (int) - 0x%016lX", lpProp->value.d);
 				break;
 			case PT_SYSTIME: {
 					struct timeval t;
 					struct tm tm;
-					get_mapi_SPropValue_array_date_timeval (&t, properties, lpProp->ulPropTag);
-					gmtime_r (&(t.tv_sec), &tm);
-					strftime (t_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
+					if (get_mapi_SPropValue_array_date_timeval (&t, properties, lpProp->ulPropTag) == MAPI_E_SUCCESS) {
+						gmtime_r (&(t.tv_sec), &tm);
+						strftime (t_str, 26, "%Y-%m-%dT%H:%M:%SZ", &tm);
+						g_print (" (struct FILETIME *) - %p\t (struct timeval) %s\t", &lpProp->value.ft, t_str);
+					}
 				}
-				g_print (" (struct FILETIME *) - %p\t (struct timeval) %s\t", &lpProp->value.ft, t_str);
 				break;
 			case PT_ERROR:
-				g_print (" (error) - %d", lpProp->value.err);
+				g_print (" (error) - "/* , lpProp->value.err */);
 				break;
 			case PT_STRING8:
 				g_print(" (string) - %s", lpProp->value.lpszA ? lpProp->value.lpszA : "null" );
 				break;
 			case PT_UNICODE:
-				g_print(" (unicodestring) - %s", lpProp->value.lpszW ? lpProp->value.lpszW : "null");
+				if (lpProp)
+					g_print(" (unicodestring) - %s", lpProp->value.lpszW ? lpProp->value.lpszW : lpProp->value.lpszA ? lpProp->value.lpszA : "null");
 				break;
 			case PT_BINARY:
-//				g_print(" (struct SBinary_short *) - %p", &lpProp->value.bin);
+				g_print(" (struct SBinary_short *) - %p Binary data follows: \n", &lpProp->value.bin);
+				for (j = 0; j < lpProp->value.bin.cb; j++)
+					g_print("0x%02X ", lpProp->value.bin.lpb[j]);
 				break;
 			case PT_MV_STRING8:
  				g_print(" (struct mapi_SLPSTRArray *) - %p", &lpProp->value.MVszA);



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