Hello everyone..

I've attached a patch to use standard enumerations [1] (as documented
in the MSDN site) instead of custom definitions. (I've also patched
other files which used these custom definitions.)

Also, the patch includes several enumerations which are not yet
defined in libmapi. This would help avoid client applications having
to re-define it over and over again. :)

Please do review/commit the same.

thanks and regards,
-Suman

[1] http://msdn.microsoft.com/en-us/library/bb277434.aspx


P.S.: the patch is against libmapi-0.7 (SVN r403). It applies well
against trunk, although I haven't tested compiling trunk with the
patch.
Index: utils/openchange-tools.c
===================================================================
--- utils/openchange-tools.c	(revision 403)
+++ utils/openchange-tools.c	(working copy)
@@ -103,7 +103,7 @@
 	if (!editor || *editor == 0) return false;
 
 	switch (*editor) {
-	case EDITOR_FORMAT_PLAINTEXT:
+	case olEditorText:
 		data = octool_get_propval(aRow, PR_BODY);
 		if (data) {
 			body->data = talloc_memdup(mem_ctx, data, strlen(data));
@@ -119,7 +119,7 @@
 			mapi_object_release(&obj_stream);
 		}
 		break;
-	case EDITOR_FORMAT_HTML:
+	case olEditorHTML:
 		bin = (const struct SBinary_short *) octool_get_propval(aRow, PR_HTML);
 		if (bin) {
 			body->data = talloc_memdup(mem_ctx, bin->lpb, bin->cb);
@@ -135,7 +135,7 @@
 			mapi_object_release(&obj_stream);
 		}			
 		break;
-	case EDITOR_FORMAT_RTF:
+	case olEditorRTF:
 		mapi_object_init(&obj_stream);
 
 		retval = OpenStream(obj_message, PR_RTF_COMPRESSED, 0, &obj_stream);
@@ -211,7 +211,7 @@
 
 	/* if PR_MSG_EDITOR_FORMAT doesn't exist, set it to PLAINTEXT */
 	if (!editor) {
-		dflt = EDITOR_FORMAT_PLAINTEXT;
+		dflt = olEditorText;
 		editor = &dflt;
 	}
 
Index: utils/openchangeclient.c
===================================================================
--- utils/openchangeclient.c	(revision 403)
+++ utils/openchangeclient.c	(working copy)
@@ -815,7 +815,7 @@
 
 	/* Set PR_BODY or PR_HTML or inline PR_HTML */
 	if (oclient->pr_body) {
-		editor = EDITOR_FORMAT_PLAINTEXT;
+		editor = olEditorText;
 		set_SPropValue_proptag(&props[3], PR_MSG_EDITOR_FORMAT, (const void *)&editor);
 
 		if (strlen(oclient->pr_body) > MAX_READ_SIZE) {
@@ -830,7 +830,7 @@
 			prop_count++;
 		}
 	} else if (oclient->pr_html_inline) {
-		editor = EDITOR_FORMAT_HTML;
+		editor = olEditorHTML;
 		set_SPropValue_proptag(&props[3], PR_MSG_EDITOR_FORMAT, (const void *)&editor);
 
 		if (strlen(oclient->pr_html_inline) > MAX_READ_SIZE) {
@@ -849,7 +849,7 @@
 		}
 		
 	} else if (&oclient->pr_html) {
-		editor = EDITOR_FORMAT_HTML;
+		editor = olEditorHTML;
 		set_SPropValue_proptag(&props[3], PR_MSG_EDITOR_FORMAT, (const void *)&editor);
 
 		if (oclient->pr_html.cb <= MAX_READ_SIZE) {
@@ -1092,7 +1092,7 @@
 		flag = 1;
 		lpProps = add_SPropValue(mem_ctx, lpProps, &cValues, PR_MESSAGE_FLAGS, (const void *)&flag);
 
-		flag= MEETING_STATUS_NONMEETING;
+		flag= olNonMeeting;
 		lpProps = add_SPropValue(mem_ctx, lpProps, &cValues, SPropTagArray->aulPropTag[2], (const void *) &flag);
 
 		flag = 30;
Index: utils/exchange2mbox.c
===================================================================
--- utils/exchange2mbox.c	(revision 403)
+++ utils/exchange2mbox.c	(working copy)
@@ -433,7 +433,7 @@
 			talloc_free(line);
 		}
 		switch (*editor) {
-		case EDITOR_FORMAT_PLAINTEXT:
+		case olEditorText:
 			line = talloc_asprintf(mem_ctx, "Content-Type: text/plain; charset=us-ascii\n");
 			if (line) fwrite(line, strlen(line), 1, fp);
 			talloc_free(line);
@@ -443,12 +443,12 @@
 			if (line) fwrite(line, strlen(line), 1, fp);
 			talloc_free(line);
 			break;
-		case EDITOR_FORMAT_HTML:
+		case olEditorHTML:
 			line = talloc_asprintf(mem_ctx, "Content-Type: text/html\n");
 			if (line) fwrite(line, strlen(line), 1, fp);
 			talloc_free(line);		
 			break;
-		case EDITOR_FORMAT_RTF:
+		case olEditorRTF:
 			line = talloc_asprintf(mem_ctx, "Content-Type: text/rtf\n");
 			if (line) fwrite(line, strlen(line), 1, fp);
 			talloc_free(line);					
Index: utils/openchangeclient.h
===================================================================
--- utils/openchangeclient.h	(revision 403)
+++ utils/openchangeclient.h	(working copy)
@@ -102,10 +102,10 @@
 };
 
 struct oc_element	oc_busystatus[] = {
-	{BUSY_STATUS_FREE,		"FREE"},
-	{BUSY_STATUS_TENTATIVE,		"TENTATIVE"},
-	{BUSY_STATUS_BUSY,		"BUSY"},
-	{BUSY_STATUS_OUTOFOFFICE,	"OUTOFOFFICE"},
+	{olFree,	"FREE"},
+	{olTentative,	"TENTATIVE"},
+	{olBusy,	"BUSY"},
+	{olOutOfOffice,	"OUTOFOFFICE"},
 	{0 , NULL}
 };
 
@@ -117,9 +117,9 @@
 };
 
 struct oc_element	oc_importance[] = {
-	{IMPORTANCE_LOW,	"LOW"},
-	{IMPORTANCE_NORMAL,	"NORMAL"},
-	{IMPORTANCE_HIGH,	"HIGH"},
+	{olImportanceLow,	"LOW"},
+	{olImportanceNormal,	"NORMAL"},
+	{olImportanceHigh,	"HIGH"},
 	{0, NULL}
 };
 
Index: torture/mapi_sendappointment.c
===================================================================
--- torture/mapi_sendappointment.c	(revision 403)
+++ torture/mapi_sendappointment.c	(working copy)
@@ -148,7 +148,7 @@
 	set_SPropValue_proptag(&props[5], PR_MESSAGE_FLAGS, (const void *) &flag);
 	set_SPropValue_proptag(&props[6], SPropTagArray->aulPropTag[0], (const void *)(location?location:""));
 	set_SPropValue_proptag(&props[7], SPropTagArray->aulPropTag[1], (const void *) &busy_status);
-	flag= MEETING_STATUS_NONMEETING;
+	flag= olNonMeeting;
 	set_SPropValue_proptag(&props[8], SPropTagArray->aulPropTag[2], (const void *) &flag);
 	flag2 = true;
 	set_SPropValue_proptag(&props[9], SPropTagArray->aulPropTag[3], (const void *) start_date);
Index: libmapi/conf/mapi-named-properties
===================================================================
--- libmapi/conf/mapi-named-properties	(revision 403)
+++ libmapi/conf/mapi-named-properties	(working copy)
@@ -124,6 +124,13 @@
 
 
 
+### Meeting named properties
+NULL                          0x0003 NULL                          PT_BINARY     MNID_ID     PSETID_Meeting
+NULL                          0x0023 NULL                          PT_BINARY     MNID_ID     PSETID_Meeting
+MeetingType                   0x0026 NULL                          PT_LONG       MNID_ID     PSETID_Meeting
+
+
+
 ### Common Named properties
 ReminderMinutesBeforeStart    0x8501 NULL                          PT_LONG       MNID_ID     PSETID_Common
 ReminderTime                  0x8502 NULL                          PT_SYSTIME    MNID_ID     PSETID_Common
Index: libmapi/mapidump.c
===================================================================
--- libmapi/mapidump.c	(revision 403)
+++ libmapi/mapidump.c	(working copy)
@@ -467,11 +467,11 @@
 _PUBLIC_ const char *get_importance(uint32_t importance)
 {
 	switch (importance) {
-	case IMPORTANCE_LOW:
+	case olImportanceLow:
 		return ("Low");
-	case IMPORTANCE_NORMAL:
+	case olImportanceNormal:
 		return ("Normal");
-	case IMPORTANCE_HIGH:
+	case olImportanceHigh:
 		return ("High");
 	}
 	return NULL;
Index: libmapi/mapidefs.h
===================================================================
--- libmapi/mapidefs.h	(revision 403)
+++ libmapi/mapidefs.h	(working copy)
@@ -146,85 +146,202 @@
 #define	PRIORITY_NORMAL		0
 #define	PRIORITY_HIGH		1
 
-/*
- * Importance
- */
+/* GENERAL */
+enum OlDaysOfWeek
+{
+    olSunday = 1,
+    olMonday = 2,
+    olTuesday = 4,
+    olWednesday = 8,
+    olThursday = 16,
+    olFriday = 32,
+    olSaturday = 64
+};
 
-#define	IMPORTANCE_LOW		0
-#define	IMPORTANCE_NORMAL	1
-#define	IMPORTANCE_HIGH		2
+enum OlSensitivity
+{
+    olNormal = 0,
+    olPersonal = 1,
+    olPrivate = 2,
+    olConfidential = 3
+};
 
-/*
- * Color
- */
+enum OlImportance
+{
+    olImportanceLow = 0,
+    olImportanceNormal = 1,
+    olImportanceHigh = 2
+};
 
-#define	olBlue			0
-#define	olGreen			1
-#define	olPink			2
-#define	olYellow		3
-#define	olWhite			4
+enum OlMailRecipientType
+{
+    olOriginator = 0, 
+    olTo = 1, 
+    olCC = 2, 
+    olBCC = 3
+};
 
-
+/* APPOINTMENTS */
 /*
  * Appointment flags with PR_APPOINTMENT_BUSY_STATUS
  */
+enum OlBusyStatus
+{
+    olFree = 0,
+    olTentative = 1,
+    olBusy = 2,
+    olOutOfOffice = 3
+};
 
-#define	BUSY_STATUS_FREE	0
-#define	BUSY_STATUS_TENTATIVE	1
-#define	BUSY_STATUS_BUSY	2
-#define	BUSY_STATUS_OUTOFOFFICE	3
+enum OlMeetingRecipientType
+{
+    olOrganizer = 0,
+    olRequired = 1,
+    olOptional = 2,
+    olResource = 3
+};
 
-/*
- * Appointment meeting status
- */
-#define MEETING_STATUS_NONMEETING	0
-#define MEETING_STATUS_MEETING		1
+enum OlMeetingResponse
+{
+    olMeetingTentative = 2,
+    olMeetingAccepted = 3,
+    olMeetingDeclined = 4
+};
 
-/*
- * Task status
- */
+enum OlResponseStatus 
+{
+    olResponseNone = 0, 
+    olResponseOrganized = 1, 
+    olResponseTentative = 2, 
+    olResponseAccepted = 3, 
+    olResponseDeclined = 4, 
+    olResponseNotResponded = 5
+};
 
-#define	olTaskNotStarted		0
-#define	olTaskInProgress		1
-#define	olTaskComplete			2
-#define	olTaskWaiting			3
-#define	olTaskDeferred			4
+enum OlMeetingStatus
+{
+    olNonMeeting = 0,
+    olMeeting = 1,
+    olMeetingReceived = 3,
+    olMeetingCanceled = 5
+};
 
-/*
- * Task OwnerShip
- */
-#define	olNewTask			0
-#define	olDelegatedTask			1
-#define	olOwnTask			2
+enum OlNetMeetingType
+{
+    olNetMeeting = 0,
+    olNetShow = 1,
+    olChat = 2
+};
 
+/* TASKS */
+enum OlTaskDelegationState
+{
+    olTaskNotDelegated = 0,
+    olTaskDelegationUnknown = 1,
+    olTaskDelegationAccepted = 2,
+    olTaskDelegationDeclined = 3
+};
+
+enum OlTaskOwnership
+{
+    olNewTask = 0,
+    olDelegatedTask = 1,
+    olOwnTask = 2
+};
+
+enum OlTaskRecipientType
+{
+    olUpdate = 2,
+    olFinalStatus = 3
+};
+
+enum OlTaskResponse
+{
+    olTaskSimple = 0,
+    olTaskAssign = 1,
+    olTaskAccept = 2,
+    olTaskDecline = 3
+};
+
+enum OlTaskStatus
+{
+    olTaskNotStarted = 0,
+    olTaskInProgress = 1,
+    olTaskComplete = 2,
+    olTaskWaiting = 3,
+    olTaskDeferred = 4
+};
+
+
+/* NOTES */
+enum OlNoteColor 
+{
+    olBlue = 0, 
+    olGreen = 1, 
+    olPink = 2, 
+    olYellow = 3, 
+    olWhite = 4
+};
+
+/* RECURRENCE (APPOINTMENTS/MEETINGS/TASKS) */
+enum OlRecurrenceState
+{
+    olApptNotRecurring = 0,
+    olApptMaster = 1,
+    olApptOccurrence = 2,
+    olApptException = 3
+};
+
+enum OlRecurrenceType
+{
+    olRecursDaily = 0,
+    olRecursWeekly = 1,
+    olRecursMonthly = 2,
+    olRecursMonthNth = 3,
+    olRecursYearly = 5,
+    olRecursYearNth = 6
+};
+
+
 /*
  * PR_MESSAGE_EDITOR_FORMAT type
  */
-#define	EDITOR_FORMAT_PLAINTEXT		1
-#define	EDITOR_FORMAT_HTML		2
-#define	EDITOR_FORMAT_RTF		3
+enum OlEditorType
+{
+    olEditorText = 1,
+    olEditorHTML = 2,
+    olEditorRTF = 3,
+    olEditorWord = 4
+};
 
 /*
  * Default folders
  */
+
+enum OlDefaultFolders {
+    olFolderDeletedItems = 3,
+    olFolderOutbox = 4,
+    olFolderSentMail = 5,
+    olFolderInbox = 6,
+    olFolderCalendar = 9,
+    olFolderContacts = 10,
+    olFolderJournal = 11,
+    olFolderNotes = 12,
+    olFolderTasks = 13,
+    olFolderDrafts = 16,
+    olPublicFoldersAllPublicFolders = 18,
+    olFolderConflicts = 19,
+    olFolderSyncIssues = 20,
+    olFolderLocalFailures = 21,
+    olFolderServerFailures = 22,
+    olFolderJunk = 23,
+    olFolderRssFeeds = 25,
+    olFolderToDo = 28,
+    olFolderManagedEmail = 29
+};
+
 #define	olFolderTopInformationStore	1
-#define	olFolderDeletedItems		3
-#define	olFolderOutbox			4
-#define	olFolderSentMail		5
-#define	olFolderInbox			6
 #define	olFolderCommonView		8
-#define	olFolderCalendar		9
-#define	olFolderContacts		10
-#define	olFolderJournal			11
-#define	olFolderNotes			12
-#define	olFolderTasks			13
-#define	olFolderDrafts			16
-#define	olPublicFoldersAllPublicFolders	18
-#define	olFolderConflicts		19
-#define	olFolderSyncIssues		20
-#define	olFolderLocalFailures		21
-#define	olFolderServerFailures		22
-#define	olFolderJunk			23
 #define	olFolderFinder			24
 #define	olFolderPublicRoot		25
 #define	olFolderPublicIPMSubtree	26
@@ -246,6 +363,7 @@
  */
 
 #define	PSETID_Appointment	"00062002-0000-0000-c000-000000000046"
+#define PSETID_Meeting		"6ed8da90-450b-101b-98da-00aa003f1305"
 #define	PSETID_Task		"00062003-0000-0000-c000-000000000046"
 #define	PSETID_Address		"00062004-0000-0000-c000-000000000046"
 #define	PSETID_Common		"00062008-0000-0000-c000-000000000046"
_______________________________________________
devel mailing list
[email protected]
http://mailman.openchange.org/listinfo/devel

Reply via email to