コード例 #1
0
/* NOTE: For now, since this function has special significance only for
 * 'string' type properties, callers should (preferably) use it for fetching
 * such properties alone. If callers are sure that proptag would, for instance,
 * return an 'int' or a 'systime', they should prefer find_mapi_SPropValue_data.
 */
gconstpointer
e_mapi_util_find_array_propval (struct mapi_SPropValue_array *properties, uint32_t proptag)
{
	if (((proptag & 0xFFFF) == PT_STRING8) ||
	    ((proptag & 0xFFFF) == PT_UNICODE)) {
		const void	*str = NULL;

		proptag = (proptag & 0xFFFF0000) | PT_UNICODE;
		str = find_mapi_SPropValue_data(properties, proptag);
		if (str)
			return str;

		proptag = (proptag & 0xFFFF0000) | PT_STRING8;
		str = find_mapi_SPropValue_data(properties, proptag);
		if (str)
			return str;

		return NULL;
	}

	/* NOTE: Similar generalizations (if any) for other property types
	 * can be made here.
	 */

	return (find_mapi_SPropValue_data(properties, proptag));
}
コード例 #2
0
ファイル: mapidump.c プロジェクト: ThHirsch/openchange
/**
   \details This function dumps the properties relating to a note to standard output

   The expected way to obtain the properties array is to use OpenMessage() to obtain the
   note object, then to use GetPropsAll() to obtain all the properties.

   \param properties array of note properties
   \param id identification to display for the note (can be NULL)

   \sa mapidump_message, mapidump_appointment, mapidump_contact, mapidump_task
*/
_PUBLIC_ void mapidump_note(struct mapi_SPropValue_array *properties, const char *id)
{
	const char		*subject = NULL;
	const char		*body = NULL;

	subject = (const char *)find_mapi_SPropValue_data(properties, PR_CONVERSATION_TOPIC);
	body = (const char *)find_mapi_SPropValue_data(properties, PR_BODY);

	printf("|== %s ==| %s\n", subject?subject:"", id?id:"");
	fflush(0);
	
	mapidump_date(properties, PR_CLIENT_SUBMIT_TIME, "Submit Time");

	if (body) {
		printf("Content:\n");
		printf("%s\n", body);
		fflush(0);
	} else {
		body = (const char *)find_mapi_SPropValue_data(properties, PR_BODY_HTML);
		if (body) {
			printf("Content HTML:\n");
			printf("%s\n", body);
			fflush(0);
		}
	}
}
コード例 #3
0
PHP_METHOD(MAPIAppointment, getRecurrence)
{
	mapi_message_object_t 	*message_obj;
	TALLOC_CTX	*mem_ctx;
	struct Binary_r	*bin_pattern;
	struct AppointmentRecurrencePattern *recurrence;
	mapi_id_t id =  0x82160102; // PidLidAppointmentRecur

	message_obj = (mapi_message_object_t *) zend_object_store_get_object(getThis() TSRMLS_CC);
	mem_ctx = message_obj->talloc_ctx;

	bin_pattern = (struct Binary_r*) find_mapi_SPropValue_data(&(message_obj->properties), id);
	recurrence = get_AppointmentRecurrencePattern(mem_ctx, bin_pattern);

	zval *res = appointment_recurrence_pattern_to_zval(recurrence);
	RETURN_ZVAL(res, 0, 1);
}
コード例 #4
0
ファイル: mapidump.c プロジェクト: ThHirsch/openchange
/**
   \details This function dumps the properties relating to an appointment to standard output

   The expected way to obtain the properties array is to use OpenMessage() to obtain the
   appointment object, then to use GetPropsAll() to obtain all the properties.

   \param properties array of appointment properties
   \param id identification to display for the appointment (can be NULL)

   \sa mapidump_message, mapidump_contact, mapidump_task, mapidump_note
*/
_PUBLIC_ void mapidump_appointment(struct mapi_SPropValue_array *properties, const char *id)
{
	const struct mapi_SLPSTRArray	*contacts = NULL;
	const char		*subject = NULL;
	const char		*location= NULL;
	const char		*timezone = NULL;
	const uint32_t		*status;
	const uint8_t	       	*priv = NULL;
	uint32_t       		i;

	contacts = (const struct mapi_SLPSTRArray *)find_mapi_SPropValue_data(properties, PidLidContacts);
	subject = (const char *)find_mapi_SPropValue_data(properties, PR_CONVERSATION_TOPIC);
	timezone = (const char *)find_mapi_SPropValue_data(properties, PidLidTimeZoneDescription);
	location = (const char *)find_mapi_SPropValue_data(properties, PidLidLocation);
	status = (const uint32_t *)find_mapi_SPropValue_data(properties, PidLidBusyStatus);
	priv = (const uint8_t *)find_mapi_SPropValue_data(properties, PidLidPrivate);

	printf("|== %s ==| %s\n", subject?subject:"", id?id:"");
	fflush(0);

	if (location) {
		printf("\tLocation: %s\n", location);
		fflush(0);
	}

	mapidump_date(properties, PR_START_DATE, "Start time");
	mapidump_date(properties, PR_END_DATE, "End time");

	if (timezone) {
		printf("\tTimezone: %s\n", timezone);
		fflush(0);
	}

	printf("\tPrivate: %s\n", (priv && (*priv == true)) ? "True" : "False");
	fflush(0);

	if (status) {
		printf("\tStatus: %s\n", get_task_status(*status));
		fflush(0);
	}

	if (contacts) {
		printf("\tContacts:\n");
		fflush(0);
		for (i = 0; i < contacts->cValues; i++) {
			printf("\t\tContact: %s\n", contacts->strings[i].lppszA);
			fflush(0);
		}
	}	
}
コード例 #5
0
ファイル: mapidump.c プロジェクト: ThHirsch/openchange
_PUBLIC_ void mapidump_date(struct mapi_SPropValue_array *properties, uint32_t mapitag, const char *label)
{
	TALLOC_CTX		*mem_ctx;
	NTTIME			time;
	const struct FILETIME	*filetime;
	const char		*date;

	mem_ctx = talloc_named(NULL, 0, "mapidump_date");

	filetime = (const struct FILETIME *) find_mapi_SPropValue_data(properties, mapitag);
	if (filetime) {
		time = filetime->dwHighDateTime;
		time = time << 32;
		time |= filetime->dwLowDateTime;
		date = nt_time_string(mem_ctx, time);
		printf("\t%-15s:   %s\n", label, date);
		fflush(0);
	}

	talloc_free(mem_ctx);
}
コード例 #6
0
/**
     \details Test the mapi_SPropValue_array handling

   This function:
   -# Builds a mapi_SPropValue_array
   -# Checks that appropriate values can be retrieved

   \param mt pointer on the top-level mapitest structure

   \return true on success, otherwise false
*/
_PUBLIC_ bool mapitest_noserver_mapi_properties(struct mapitest *mt) 
{
	struct mapi_SPropValue_array valarray;
	const uint16_t *i2get;
	const uint32_t *i4get;
	const uint32_t *i8get;
	const uint8_t *boolget;
	const char *stringget;
	const struct FILETIME *ftget;
	const struct SBinary_short *binget;
	const struct mapi_MV_LONG_STRUCT *mvi4get;

	valarray.cValues = 8;
	valarray.lpProps = talloc_array(mt->mem_ctx, struct mapi_SPropValue, valarray.cValues);

	valarray.lpProps[0].ulPropTag = PR_GENDER;
	valarray.lpProps[0].value.i = 0x0001;  /* Female */
	valarray.lpProps[1].ulPropTag = PR_ORIGINAL_SENSITIVITY;
	valarray.lpProps[1].value.l = 0x00000002; /* Private */
	valarray.lpProps[2].ulPropTag = PR_ALTERNATE_RECIPIENT_ALLOWED;
	valarray.lpProps[2].value.b = false; 
	valarray.lpProps[3].ulPropTag = PR_CONVERSATION_TOPIC;
	valarray.lpProps[3].value.lpszA = "Elizabeth's Birthday"; 
	valarray.lpProps[4].ulPropTag = PR_MESSAGE_SIZE_EXTENDED;
	valarray.lpProps[4].value.d = 43857;
	valarray.lpProps[5].ulPropTag = PR_RECORD_KEY;
	valarray.lpProps[5].value.bin.cb = 4;
	valarray.lpProps[5].value.bin.lpb = talloc_array(mt->mem_ctx, uint8_t, 4);
	valarray.lpProps[5].value.bin.lpb[0] = 0x44;
	valarray.lpProps[5].value.bin.lpb[1] = 0x00;
	valarray.lpProps[5].value.bin.lpb[2] = 0x20;
	valarray.lpProps[5].value.bin.lpb[3] = 0x00;
	valarray.lpProps[6].ulPropTag = PR_SCHDINFO_MONTHS_BUSY;
	valarray.lpProps[6].value.MVl.cValues = 2;
	valarray.lpProps[6].value.MVl.lpl = talloc_array(mt->mem_ctx, uint32_t, 2);
	valarray.lpProps[6].value.MVl.lpl[0] = 32130;
	valarray.lpProps[6].value.MVl.lpl[1] = 32131;
	valarray.lpProps[7].ulPropTag = PidLidAppointmentEndWhole;
	valarray.lpProps[7].value.ft.dwLowDateTime  = 0x12975909;
	valarray.lpProps[7].value.ft.dwHighDateTime  = 0x98989204;

	/* now start pulling the values back out */
	i2get = find_mapi_SPropValue_data(&valarray, PR_GENDER);
	if (!i2get || (*i2get != 0x0001)) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_SHORT");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_SHORT");


	i4get = find_mapi_SPropValue_data(&valarray, PR_ORIGINAL_SENSITIVITY);
	if (!i4get || (*i4get != 0x00000002)) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_LONG");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_LONG");


	i8get = find_mapi_SPropValue_data(&valarray, PR_MESSAGE_SIZE_EXTENDED);
	if (!i8get || (*i8get != 43857)) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_I8");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_I8");


	boolget = find_mapi_SPropValue_data(&valarray, PR_ALTERNATE_RECIPIENT_ALLOWED);
	if (!boolget || (*boolget != false)) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_BOOLEAN");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_BOOLEAN");


	stringget = find_mapi_SPropValue_data(&valarray, PR_CONVERSATION_TOPIC);
	if (!stringget || (strcmp(stringget, "Elizabeth's Birthday") !=0 )) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_STRING");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_STRING");

	ftget = find_mapi_SPropValue_data(&valarray, PidLidAppointmentEndWhole);
	if (!ftget || (ftget->dwLowDateTime != 0x12975909) || (ftget->dwHighDateTime != 0x98989204)) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_FILETIME");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_FILETIME");

	binget = find_mapi_SPropValue_data(&valarray, PR_RECORD_KEY);
	if (!binget || (binget->cb != 4 ) || (binget->lpb[0] != 0x44) || (binget->lpb[1] != 0x00)
	    || (binget->lpb[2] != 0x20) || (binget->lpb[3] != 0x00)) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_BINARY");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_BINARY");


	mvi4get = find_mapi_SPropValue_data(&valarray, PR_SCHDINFO_MONTHS_BUSY);
	if (!mvi4get || (mvi4get->cValues != 2 ) || (mvi4get->lpl[0] != 32130) || (mvi4get->lpl[1] != 32131)) {
		/* failure */
		mapitest_print(mt, "* %-40s: [FAILURE]\n", "mapi_SPropValue find with PT_MV_LONG");
		return false;
	}
	mapitest_print(mt, "* %-40s: [SUCCESS]\n", "mapi_SPropValue find with PT_MV_LONG");

#if 0
	// Types to still to test:
        int64_t dbl;/* [case(0x0005)] */
        uint32_t err;/* [case(0x000a)] */
        const char * lpszW;/* [flag(LIBNDR_FLAG_STR_NULLTERM),case(0x001f)] */
        struct GUID lpguid;/* [case(0x0048)] */
        struct mapi_SRestriction_wrap Restrictions;/* [case(0x00fd)] */
        struct RuleAction RuleAction;/* [case(0x00fe)] */
        struct mapi_SLPSTRArray MVszA;/* [case(0x101e)] */
        struct mapi_SPLSTRArrayW MVszW;/* [case(0x101f)] */
        struct mapi_SGuidArray MVguid;/* [case(0x1048)] */
        struct mapi_SBinaryArray MVbin;/* [case(0x1102)] */
#endif
	return true;
}
コード例 #7
0
ファイル: mapidump.c プロジェクト: ThHirsch/openchange
/**
   \details This function dumps the properties relating to a task (to-do list entry)
   to standard output

   The expected way to obtain the properties array is to use OpenMessage() to obtain the
   task object, then to use GetPropsAll() to obtain all the properties.

   \param properties array of task properties
   \param id identification to display for the task (can be NULL)

   \sa mapidump_message, mapidump_appointment, mapidump_contact, mapidump_note
*/
_PUBLIC_ void mapidump_task(struct mapi_SPropValue_array *properties, const char *id)
{
	const struct mapi_SLPSTRArray	*contacts = NULL;
	const char			*subject = NULL;
	const char			*body = NULL;
	const double			*complete = 0;
	const uint32_t			*status;
	const uint32_t			*importance;
	const uint8_t			*private_tag;
	uint32_t       			i;

	contacts = (const struct mapi_SLPSTRArray *)find_mapi_SPropValue_data(properties, PidLidContacts);
	subject = (const char *)find_mapi_SPropValue_data(properties, PR_CONVERSATION_TOPIC);
	body = (const char *)find_mapi_SPropValue_data(properties, PR_BODY);
	complete = (const double *)find_mapi_SPropValue_data(properties, PidLidPercentComplete);
	status = (const uint32_t *)find_mapi_SPropValue_data(properties, PidLidTaskStatus);
	importance = (const uint32_t *)find_mapi_SPropValue_data(properties, PR_IMPORTANCE);
	private_tag = (const uint8_t *)find_mapi_SPropValue_data(properties, PidLidPrivate);

	printf("|== %s ==| %s\n", subject?subject:"", id?id:"");
	fflush(0);

	printf("\tBody: %s\n", body?body:"none");
	fflush(0);

	if (complete) {
		printf("\tComplete: %u %c\n", (uint32_t)(*complete * 100), '%');
		fflush(0);
	}

	if (status) {
		printf("\tStatus: %s\n", get_task_status(*status));
		fflush(0);
		if (*status == olTaskComplete) {
			mapidump_date(properties, PidLidTaskDateCompleted, "Date Completed");
		}
	}

	if (importance) {
		printf("\tImportance: %s\n", get_importance(*importance));
		fflush(0);
	}

	mapidump_date(properties, PidLidTaskDueDate,"Due Date");
	mapidump_date(properties, PidLidTaskStartDate, "Start Date");

	if (private_tag) {
		printf("\tPrivate: %s\n", (*private_tag == true)?"True":"False");
		fflush(0);
	} else {
		printf("\tPrivate: false\n");
		fflush(0);
	}

	if (contacts) {
		for (i = 0; i < contacts->cValues; i++) {
			printf("\tContact: %s\n", contacts->strings[i].lppszA);
			fflush(0);
		}
	}
}
コード例 #8
0
ファイル: mapidump.c プロジェクト: ThHirsch/openchange
/**
   \details This function dumps the properties relating to a contact (address book entry)
   to standard output

   The expected way to obtain the properties array is to use OpenMessage() to obtain the
   contact object, then to use GetPropsAll() to obtain all the properties.

   \param properties array of contact properties
   \param id identification to display for the contact (can be NULL)

   \sa mapidump_message, mapidump_appointment, mapidump_task, mapidump_note
*/
_PUBLIC_ void mapidump_contact(struct mapi_SPropValue_array *properties, const char *id)
{
	const char	*card_name =NULL;
	const char	*topic =NULL;
	const char	*full_name = NULL;
	const char	*given_name = NULL;
	const char	*surname = NULL;
	const char	*company = NULL;
	const char	*email = NULL;
	const char	*title = NULL;
	const char      *office_phone = NULL;
	const char      *home_phone = NULL;
	const char      *mobile_phone = NULL;
	const char      *postal_address = NULL;
	const char      *street_address = NULL;
	const char      *locality = NULL;
	const char      *state = NULL;
	const char      *country = NULL;
	const char      *department = NULL;
	const char      *business_fax = NULL;
	const char      *business_home_page = NULL;

	card_name = (const char *)find_mapi_SPropValue_data(properties, PidLidFileUnder);
	topic = (const char *)find_mapi_SPropValue_data(properties, PR_CONVERSATION_TOPIC);
	company = (const char *)find_mapi_SPropValue_data(properties, PR_COMPANY_NAME);
	title = (const char *)find_mapi_SPropValue_data(properties, PR_TITLE);
	full_name = (const char *)find_mapi_SPropValue_data(properties, PR_DISPLAY_NAME);
	given_name = (const char *)find_mapi_SPropValue_data(properties, PR_GIVEN_NAME);
	surname = (const char *)find_mapi_SPropValue_data(properties, PR_SURNAME);
	department = (const char *)find_mapi_SPropValue_data(properties, PR_DEPARTMENT_NAME);
	email = (const char *)find_mapi_SPropValue_data(properties, PidLidEmail1OriginalDisplayName);
	office_phone = (const char *)find_mapi_SPropValue_data(properties, PR_OFFICE_TELEPHONE_NUMBER);
	home_phone = (const char *)find_mapi_SPropValue_data(properties, PR_HOME_TELEPHONE_NUMBER);
	mobile_phone = (const char *)find_mapi_SPropValue_data(properties, PR_MOBILE_TELEPHONE_NUMBER);
	business_fax = (const char *)find_mapi_SPropValue_data(properties, PR_BUSINESS_FAX_NUMBER);
	business_home_page = (const char *)find_mapi_SPropValue_data(properties, PR_BUSINESS_HOME_PAGE);
	postal_address = (const char*)find_mapi_SPropValue_data(properties, PR_POSTAL_ADDRESS);
	street_address = (const char*)find_mapi_SPropValue_data(properties, PR_STREET_ADDRESS);
	locality = (const char*)find_mapi_SPropValue_data(properties, PR_LOCALITY);
	state = (const char*)find_mapi_SPropValue_data(properties, PR_STATE_OR_PROVINCE);
	country = (const char*)find_mapi_SPropValue_data(properties, PR_COUNTRY);

	if (card_name) 
		printf("|== %s ==| %s\n", card_name, id?id:"");
	else if (topic)
		printf("|== %s ==| %s\n", topic, id?id:"");
	else 
	  printf("|== <Unknown> ==| %s\n", id?id:"");
	fflush(0);
	if (topic) printf("Topic: %s\n", topic);
	fflush(0);
	if (full_name)
		printf("Full Name: %s\n", full_name);
	else if (given_name && surname)
		printf("Full Name: %s %s\n", given_name, surname); // initials? l10n?
	fflush(0);
	if (title) printf("Job Title: %s\n", title);
	fflush(0);
	if (department) printf("Department: %s\n", department);
	fflush(0);
	if (company) printf("Company: %s\n", company);
	fflush(0);
	if (email) printf("E-mail: %s\n", email);
	fflush(0);
	if (office_phone) printf("Office phone number: %s\n", office_phone);
	fflush(0);
	if (home_phone) printf("Work phone number: %s\n", home_phone);
	fflush(0);
	if (mobile_phone) printf("Mobile phone number: %s\n", mobile_phone);
	fflush(0);
	if (business_fax) printf("Business fax number: %s\n", business_fax);
	fflush(0);
	if (business_home_page) printf("Business home page: %s\n", business_home_page);
	fflush(0);
	if (postal_address) printf("Postal address: %s\n", postal_address);
	fflush(0);
	if (street_address) printf("Street address: %s\n", street_address);
	fflush(0);
	if (locality) printf("Locality: %s\n", locality);
	fflush(0);
	if (state) printf("State / Province: %s\n", state);
	fflush(0);
	if (country) printf("Country: %s\n", country);
	fflush(0);

	printf("\n");
}
コード例 #9
0
ファイル: mapidump.c プロジェクト: ThHirsch/openchange
/**
   \details This function dumps the properties relating to an email message to standard output

   The expected way to obtain the properties array is to use OpenMessage() to obtain the
   message object, then to use GetPropsAll() to obtain all the properties.

   \param properties array of message properties
   \param id identification to display for the message (can be NULL)
   \param obj_msg pointer to the message MAPI object (can be NULL)

   \sa mapidump_appointment, mapidump_contact, mapidump_task, mapidump_note
*/
_PUBLIC_ void mapidump_message(struct mapi_SPropValue_array *properties, const char *id, mapi_object_t *obj_msg)
{
	const char			*msgid;
	const char			*from;
	const char			*to;
	const char			*cc;
	const char			*bcc;
	const char			*subject;
	const char			*body;
	const char			*codepage;
	const struct SBinary_short	*html = NULL;
	const uint8_t			*has_attach;
	const uint32_t       		*cp;

	msgid = (const char *)find_mapi_SPropValue_data(properties, PR_INTERNET_MESSAGE_ID_UNICODE);
	if (!msgid)
		msgid = (const char *)find_mapi_SPropValue_data(properties, PR_INTERNET_MESSAGE_ID);
	subject = (const char *) find_mapi_SPropValue_data(properties, PR_CONVERSATION_TOPIC_UNICODE);
	if (!subject)
		subject = (const char *) find_mapi_SPropValue_data(properties, PR_CONVERSATION_TOPIC);
	body = (const char *) find_mapi_SPropValue_data(properties, PR_BODY_UNICODE);
	if (!body) {
		body = (const char *) find_mapi_SPropValue_data(properties, PR_BODY);
		if (!body) {
			html = (const struct SBinary_short *) find_mapi_SPropValue_data(properties, PR_HTML);
		}
	}
	from = (const char *) find_mapi_SPropValue_data(properties, PR_SENT_REPRESENTING_NAME_UNICODE);
	if (!from)
		from = (const char *) find_mapi_SPropValue_data(properties, PR_SENT_REPRESENTING_NAME);
	to = (const char *) find_mapi_SPropValue_data(properties, PR_DISPLAY_TO_UNICODE);
	if (!to)
		to = (const char *) find_mapi_SPropValue_data(properties, PR_DISPLAY_TO);
	cc = (const char *) find_mapi_SPropValue_data(properties, PR_DISPLAY_CC_UNICODE);
	if (!cc)
		cc = (const char *) find_mapi_SPropValue_data(properties, PR_DISPLAY_CC);
	bcc = (const char *) find_mapi_SPropValue_data(properties, PR_DISPLAY_BCC_UNICODE);
	if (!bcc)
		bcc = (const char *) find_mapi_SPropValue_data(properties, PR_DISPLAY_BCC);

	has_attach = (const uint8_t *)find_mapi_SPropValue_data(properties, PR_HASATTACH);

	cp = (const uint32_t *)find_mapi_SPropValue_data(properties, PR_MESSAGE_CODEPAGE);
	switch (cp ? *cp : 0) {
	case CP_USASCII:
		codepage = "CP_USASCII";
		break;
	case CP_UNICODE:
		codepage = "CP_UNICODE";
		break;
	case CP_JAUTODETECT:
		codepage = "CP_JAUTODETECT";
		break;
	case CP_KAUTODETECT:
		codepage = "CP_KAUTODETECT";
		break;
	case CP_ISO2022JPESC:
		codepage = "CP_ISO2022JPESC";
		break;
	case CP_ISO2022JPSIO:
		codepage = "CP_ISO2022JPSIO";
		break;
	default:
		codepage = "";
		break;
	}

	printf("+-------------------------------------+\n");
	printf("message id: %s %s\n", msgid ? msgid : "", id?id:"");
	if (obj_msg) {
		mapidump_message_summary(obj_msg);
	} else {
		printf("subject: %s\n", subject ? subject : "");
		printf("From: %s\n", from ? from : "");
		printf("To:  %s\n", to ? to : "");
		printf("Cc:  %s\n", cc ? cc : "");
		printf("Bcc: %s\n", bcc ? bcc : "");
	}
	if (has_attach) {
		printf("Attachment: %s\n", *has_attach ? "True" : "False");
	}
	printf("Codepage: %s\n", codepage);
	printf("Body:\n");
	fflush(0);
	if (body) {
		printf("%s\n", body);
	} else if (html) {
		write(1, html->lpb, html->cb);
		write(1, "\n", 1);
		fflush(0);
	}
}