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



Author: msuman
Date: Thu Jun 26 04:30:30 2008
New Revision: 9046
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9046&view=rev

Log:
Use a single FetchCallback instead of separate ones for fetch_item and fetch_items, new utility API, new enum in exchange-mapi-defs.h

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-connection.h
   branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-defs.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	Thu Jun 26 04:30:30 2008
@@ -909,7 +909,7 @@
 					const uint32_t *GetPropsList, const uint16_t cn_props, 
 					BuildNameID build_name_id, 
 					struct mapi_SRestriction *res,
-					FetchItemsCallback cb, 
+					FetchCallback cb, 
 					gpointer data, guint32 options)
 {
 	enum MAPISTATUS retval;
@@ -1099,7 +1099,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)) {
+			if (!cb (&properties_array, *pfid, *pmid, stream_list, recip_list, attach_list, data, NULL)) {
 				g_warning ("%s(%d): %s: Callback failed for message-id %016llX \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, *pmid);
 			}
 		}
@@ -1128,7 +1128,7 @@
 gpointer
 exchange_mapi_connection_fetch_item (mapi_id_t fid, mapi_id_t mid, 
 				     const uint32_t *GetPropsList, const uint16_t cn_props, 
-				     BuildNameID build_name_id, FetchItemCallback cb, 
+				     BuildNameID build_name_id, FetchCallback cb, 
 				     gpointer data, guint32 options)
 {
 	enum MAPISTATUS retval;
@@ -1252,7 +1252,7 @@
 		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);
+		cb (&properties_array, fid, mid, stream_list, recip_list, attach_list, NULL, &retobj);
 	}
 
 //	if (GetPropsTagArray->cValues) 
@@ -1491,7 +1491,7 @@
 
 struct SPropTagArray *
 exchange_mapi_util_resolve_named_props (uint32_t olFolder, mapi_id_t fid, 
-				   BuildNameID build_name_id, gpointer ni_data)
+					BuildNameID build_name_id, gpointer ni_data)
 {
 	enum MAPISTATUS retval;
 	TALLOC_CTX *mem_ctx;
@@ -1567,6 +1567,77 @@
 	return ret_array;
 }
 
+struct SPropTagArray *
+exchange_mapi_util_resolve_named_prop (uint32_t olFolder, mapi_id_t fid, uint16_t lid, const char *OLEGUID)
+{
+	enum MAPISTATUS retval;
+	TALLOC_CTX *mem_ctx;
+	mapi_object_t obj_store;
+	mapi_object_t obj_folder;
+	struct mapi_nameid *nameid;
+	struct SPropTagArray *SPropTagArray, *ret_array = NULL;
+	uint32_t i;
+
+	d(g_print("%s(%d): Entering %s \n", __FILE__, __LINE__, __PRETTY_FUNCTION__));
+
+	LOCK ();
+	LOGALL ();
+	mem_ctx = talloc_init("ExchangeMAPI_ResolveNamedProp");
+	mapi_object_init(&obj_store);
+	mapi_object_init(&obj_folder);
+
+	nameid = mapi_nameid_new(mem_ctx);
+	SPropTagArray = talloc_zero(mem_ctx, struct SPropTagArray);
+
+	/* Open the message store */
+	retval = OpenMsgStore(&obj_store);
+	if (retval != MAPI_E_SUCCESS) {
+		mapi_errstr("OpenMsgStore", GetLastError());
+		goto cleanup;
+	}
+
+	/* If fid not present then we'll use olFolder. Document this in API doc. */
+	if (fid == 0) {
+		retval = GetDefaultFolder(&obj_store, &fid, olFolder);
+		if (retval != MAPI_E_SUCCESS) {
+			mapi_errstr("GetDefaultFolder", GetLastError());
+			goto cleanup;
+		}
+	}
+
+	/* Attempt to open the folder */
+	retval = OpenFolder(&obj_store, fid, &obj_folder);
+	if (retval != MAPI_E_SUCCESS) {
+		mapi_errstr("OpenFolder", GetLastError());
+		goto cleanup;
+	}
+
+	mapi_nameid_lid_add (nameid, lid, OLEGUID);
+
+	retval = mapi_nameid_GetIDsFromNames(nameid, &obj_folder, SPropTagArray);
+	if (retval != MAPI_E_SUCCESS) {
+		mapi_errstr("mapi_nameid_GetIDsFromNames", GetLastError());
+		goto cleanup;
+	}
+
+	ret_array = g_new0 (struct SPropTagArray, 1);
+	ret_array->aulPropTag = g_new0 (enum MAPITAGS, SPropTagArray->cValues);
+	ret_array->cValues = SPropTagArray->cValues;
+	for (i = 0; i < SPropTagArray->cValues; ++i)
+		ret_array->aulPropTag[i] = SPropTagArray->aulPropTag[i];
+
+cleanup:
+	mapi_object_release(&obj_folder);
+	mapi_object_release(&obj_store);
+	talloc_free(mem_ctx);
+	LOGNONE ();
+	UNLOCK ();
+
+	d(g_print("%s(%d): Leaving %s \n", __FILE__, __LINE__, __PRETTY_FUNCTION__));
+
+	return ret_array;
+}
+
 uint32_t
 exchange_mapi_util_create_named_prop (uint32_t olFolder, mapi_id_t fid, 
 				      const char *named_prop_name, uint32_t ptype)
@@ -1578,7 +1649,7 @@
 	struct GUID guid;
 	struct MAPINAMEID *nameid;
 	struct SPropTagArray *SPropTagArray;
-	uint32_t propID = 0x0000;
+	uint32_t propID = 0x00000000;
 
 	d(g_print("%s(%d): Entering %s \n", __FILE__, __LINE__, __PRETTY_FUNCTION__));
 

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	Thu Jun 26 04:30:30 2008
@@ -87,10 +87,8 @@
 	mapi_id_t id;
 };
 
-typedef gboolean (*FetchItemsCallback) 	(struct mapi_SPropValue_array *, const mapi_id_t fid, const mapi_id_t mid, 
-					GSList *streams, GSList *recipients, GSList *attachments, gpointer data);
-typedef gpointer (*FetchItemCallback) 	(struct mapi_SPropValue_array *, const mapi_id_t fid, const mapi_id_t mid, 
-					GSList *streams, GSList *recipients, GSList *attachments);
+typedef gboolean (*FetchCallback) 	(struct mapi_SPropValue_array *, const mapi_id_t fid, const mapi_id_t mid, 
+					GSList *streams, GSList *recipients, GSList *attachments, gpointer in, gpointer out);
 typedef gboolean (*BuildNameID) 	(struct mapi_nameid *nameid, gpointer data);
 typedef int 	 (*BuildProps) 		(struct SPropValue **, struct SPropTagArray *, gpointer data);
 
@@ -106,13 +104,13 @@
 gpointer
 exchange_mapi_connection_fetch_item (mapi_id_t fid, mapi_id_t mid, 
 				     const uint32_t *GetPropsList, const uint16_t cn_props, 
-				     BuildNameID build_name_id, FetchItemCallback cb, 
+				     BuildNameID build_name_id, FetchCallback cb, 
 				     gpointer data, guint32 options);
 gboolean
 exchange_mapi_connection_fetch_items (mapi_id_t fid, 
 				      const uint32_t *GetPropsList, const uint16_t cn_props, BuildNameID build_name_id,  
 				      struct mapi_SRestriction *res, 
-				      FetchItemsCallback cb, gpointer data, guint32 options);
+				      FetchCallback cb, gpointer data, guint32 options);
 
 mapi_id_t 
 exchange_mapi_create_folder (uint32_t olFolder, mapi_id_t pfid, const char *name);
@@ -146,6 +144,9 @@
 struct SPropTagArray *
 exchange_mapi_util_resolve_named_props (uint32_t olFolder, mapi_id_t fid, 
 				   BuildNameID build_name_id, gpointer ni_data);
+struct SPropTagArray *
+exchange_mapi_util_resolve_named_prop (uint32_t olFolder, mapi_id_t fid, 
+				       uint16_t lid, const char *OLEGUID);
 uint32_t
 exchange_mapi_util_create_named_prop (uint32_t olFolder, mapi_id_t fid, 
 				      const char *named_prop_name, uint32_t ptype);

Modified: branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-defs.h
==============================================================================
--- branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-defs.h	(original)
+++ branches/EXCHANGE_MAPI_BRANCH/servers/mapi/exchange-mapi-defs.h	Thu Jun 26 04:30:30 2008
@@ -29,8 +29,7 @@
 G_BEGIN_DECLS
 
 /* GENERAL */
-typedef enum 
-{
+typedef enum {
     olSunday = 1,
     olMonday = 2,
     olTuesday = 4,
@@ -40,40 +39,48 @@
     olSaturday = 64
 } OlDaysOfWeek;
 
-typedef enum 
-{
+typedef enum {
     olNormal = 0,
     olPersonal = 1,
     olPrivate = 2,
     olConfidential = 3
 } OlSensitivity;
 
-typedef enum 
-{
+typedef enum {
     olImportanceLow = 0,
     olImportanceNormal = 1,
     olImportanceHigh = 2
 } OlImportance;
 
-typedef enum 
-{
+typedef enum {
     olOriginator = 0,
     olTo = 1,
     olCC = 2,
     olBCC = 3
 } OlMailRecipientType;
 
-typedef enum 
-{
+typedef enum {
     olEditorText = 1,
     olEditorHTML = 2,
     olEditorRTF = 3,
     olEditorWord = 4
 } OlEditorType; /* PR_MESSAGE_EDITOR_FORMAT type */
 
+typedef enum {
+    SingleAppt = 0x0400 ,
+    RecurAppt = 0x0401 ,
+    SingleMeet = 0x0402 , 
+    RecurMeet = 0x0403 ,
+    MeetReq = 0x0404 ,
+    RespAccept = 0x0405 ,
+    RespDecline = 0x0406 ,
+    RespTentAccept = 0x0407 ,
+    MeetCancel = 0x0408 ,
+    MeetInfoUpdate = 0x0409 
+} IconIndex;
+
 #if 0
-typedef enum 
-{
+typedef enum {
     olFolderDeletedItems = 3,
     olFolderOutbox = 4,
     olFolderSentMail = 5,
@@ -104,31 +111,27 @@
 
 
 /* APPOINTMENTS */
-typedef enum 
-{
+typedef enum {
     olFree = 0,
     olTentative = 1,
     olBusy = 2,
     olOutOfOffice = 3
 } OlBusyStatus; /* Appointment flags with PR_APPOINTMENT_BUSY_STATUS */
 
-typedef enum 
-{
+typedef enum {
     olOrganizer = 0,
     olRequired = 1,
     olOptional = 2,
     olResource = 3
 } OlMeetingRecipientType;
 
-typedef enum 
-{
+typedef enum {
     olMeetingTentative = 2,
     olMeetingAccepted = 3,
     olMeetingDeclined = 4
 } OlMeetingResponse;
 
-typedef enum 
-{
+typedef enum {
     olResponseNone = 0,
     olResponseOrganized = 1,
     olResponseTentative = 2,
@@ -137,8 +140,7 @@
     olResponseNotResponded = 5
 } OlResponseStatus;
 
-typedef enum 
-{
+typedef enum {
     mtgEmpty = 		0x00000000,
     mtgRequest = 	0x00000001,
     mtgFull = 		0x00010000,
@@ -147,16 +149,14 @@
     mtgDelegatorCopy = 	0x00100000
 } MeetingType;
 
-typedef enum 
-{
+typedef enum {
     olNonMeeting = 0,
     olMeeting = 1,
     olMeetingReceived = 3,
     olMeetingCanceled = 5
 } OlMeetingStatus;
 
-typedef enum 
-{
+typedef enum {
     olNetMeeting = 0,
     olNetShow = 1,
     olChat = 2
@@ -164,8 +164,7 @@
 
 
 /* TASKS */
-typedef enum 
-{
+typedef enum {
     olTaskNotDelegated = 0,
     olTaskDelegationUnknown = 1,
     olTaskDelegationAccepted = 2,
@@ -173,22 +172,19 @@
 } OlTaskDelegationState;
 
 #if 0
-typedef enum 
-{
+typedef enum {
     olNewTask = 0,
     olDelegatedTask = 1,
     olOwnTask = 2
 } OlTaskOwnership;
 #endif
 
-typedef enum 
-{
+typedef enum {
     olUpdate = 2,
     olFinalStatus = 3
 } OlTaskRecipientType;
 
-typedef enum 
-{
+typedef enum {
     olTaskSimple = 0,
     olTaskAssign = 1,
     olTaskAccept = 2,
@@ -196,8 +192,7 @@
 } OlTaskResponse;
 
 #if 0
-typedef enum 
-{
+typedef enum {
     olTaskNotStarted = 0,
     olTaskInProgress = 1,
     olTaskComplete = 2,
@@ -209,8 +204,7 @@
 
 /* NOTES */
 #if 0
-typedef enum 
-{
+typedef enum {
     olBlue = 0,
     olGreen = 1,
     olPink = 2,
@@ -221,16 +215,14 @@
 
 
 /* RECURRENCE (APPOINTMENTS/MEETINGS/TASKS) */
-typedef enum 
-{
+typedef enum {
     olApptNotRecurring = 0,
     olApptMaster = 1,
     olApptOccurrence = 2,
     olApptException = 3
 } OlRecurrenceState;
 
-typedef enum 
-{
+typedef enum {
     olRecursDaily = 0,
     olRecursWeekly = 1,
     olRecursMonthly = 2,



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