evolution-data-server r9302 - in branches/EXCHANGE_MAPI_BRANCH: camel/providers/mapi servers/mapi
- From: msuman svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r9302 - in branches/EXCHANGE_MAPI_BRANCH: camel/providers/mapi servers/mapi
- Date: Mon, 11 Aug 2008 03:58:48 +0000 (UTC)
Author: msuman
Date: Mon Aug 11 03:58:48 2008
New Revision: 9302
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9302&view=rev
Log:
Use GetBestBody algorithm as an option rather than hard-coding it, fixed a typo in camel fetch_item_cb which resolves the rendering issue for meeting-related messages.
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-connection.h
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 Mon Aug 11 03:58:48 2008
@@ -733,8 +733,11 @@
appointment_body_str = exchange_mapi_cal_util_camel_helper (array, streams, recipients, attachments);
body = g_new0(ExchangeMAPIStream, 1);
+ body->proptag = PR_BODY;
body->value = g_byte_array_new ();
- body->value - g_byte_array_append (body->value, appointment_body_str, strlen (appointment_body_str));
+ body->value = g_byte_array_append (body->value, appointment_body_str, strlen (appointment_body_str));
+
+ item->msg.body_parts = g_slist_append (item->msg.body_parts, body);
item->is_cal = TRUE;
} else {
@@ -1020,7 +1023,7 @@
camel_GetPropsList, G_N_ELEMENTS (camel_GetPropsList),
camel_build_name_id, NULL,
fetch_item_cb, &item,
- MAPI_OPTIONS_FETCH_ALL);
+ MAPI_OPTIONS_FETCH_ALL | MAPI_OPTIONS_GETBESTBODY);
if (item == NULL) {
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_INVALID, _("Could not get message"));
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 Aug 11 03:58:48 2008
@@ -245,11 +245,8 @@
return (retval == MAPI_E_SUCCESS);
}
-/*
- * Fetch the body given PR_MSG_EDITOR_FORMAT property value
- */
static gboolean
-exchange_mapi_util_read_body_stream (mapi_object_t *obj_message, GSList **stream_list)
+exchange_mapi_util_read_body_stream (mapi_object_t *obj_message, GSList **stream_list, gboolean getbestbody)
{
enum MAPISTATUS retval;
TALLOC_CTX *mem_ctx;
@@ -259,11 +256,11 @@
uint32_t count;
/* common email fields */
DATA_BLOB body;
- uint8_t editor;
+ uint8_t editor;
mapi_object_t obj_stream;
const char *data = NULL;
const bool *rtf_in_sync;
- uint32_t dflt;
+ const uint32_t *ui32 = NULL;
uint32_t proptag = 0;
/* sanity check */
@@ -274,7 +271,8 @@
mem_ctx = talloc_init ("ExchangeMAPI_ReadBodyStream");
/* Build the array of properties we want to fetch */
- SPropTagArray = set_SPropTagArray(mem_ctx, 0x7,
+ SPropTagArray = set_SPropTagArray(mem_ctx, 0x8,
+ PR_MSG_EDITOR_FORMAT,
PR_BODY,
PR_BODY_UNICODE,
PR_BODY_HTML,
@@ -297,17 +295,24 @@
aRow.cValues = count;
aRow.lpProps = lpProps;
- /* Use BestBody Algo */
- retval = GetBestBody(obj_message, &editor);
- if (retval != MAPI_E_SUCCESS) {
- mapi_errstr("GetBestBody", GetLastError());
- editor = olEditorText; /*On failure, fallback to Plain Text*/
+ if (getbestbody) {
+ /* Use BestBody Algo */
+ retval = GetBestBody(obj_message, &editor);
+ if (retval != MAPI_E_SUCCESS) {
+ mapi_errstr("GetBestBody", GetLastError());
+ /* On failure, fallback to Plain Text */
+ editor = olEditorText;
+ }
+
+ /* HACK : We can't handle RTF. So default to HTML */
+ if (editor != olEditorText && editor != olEditorHTML)
+ editor = olEditorHTML;
+ } else {
+ ui32 = (const uint32_t *) find_SPropValue_data(&aRow, PR_MSG_EDITOR_FORMAT);
+ /* if PR_MSG_EDITOR_FORMAT doesn't exist, set it to PLAINTEXT */
+ editor = ui32 ? *ui32 : olEditorText;
}
- /* HACK : We can't handle RTF. So default to HTML*/
- if (editor != olEditorText && editor != olEditorHTML)
- editor = olEditorHTML;
-
/* initialize body DATA_BLOB */
body.data = NULL;
body.length = 0;
@@ -1065,7 +1070,6 @@
return mids;
}
-// FIXME: May be we need to support Restrictions/Filters here. May be after libmapi-0.7.
gboolean
exchange_mapi_connection_fetch_items (mapi_id_t fid,
struct mapi_SRestriction *res,
@@ -1230,7 +1234,8 @@
/* get the main body stream no matter what */
if (options & MAPI_OPTIONS_FETCH_BODY_STREAM)
- exchange_mapi_util_read_body_stream (&obj_message, &stream_list);
+ exchange_mapi_util_read_body_stream (&obj_message, &stream_list,
+ options & MAPI_OPTIONS_GETBESTBODY);
if (GetPropsTagArray->cValues) {
struct SPropValue *lpProps;
@@ -1387,7 +1392,8 @@
/* get the main body stream no matter what */
if (options & MAPI_OPTIONS_FETCH_BODY_STREAM)
- exchange_mapi_util_read_body_stream (&obj_message, &stream_list);
+ exchange_mapi_util_read_body_stream (&obj_message, &stream_list,
+ options & MAPI_OPTIONS_GETBESTBODY);
if (GetPropsTagArray->cValues) {
struct SPropValue *lpProps;
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 Mon Aug 11 03:58:48 2008
@@ -34,7 +34,8 @@
MAPI_OPTIONS_FETCH_RECIPIENTS = 1<<1,
MAPI_OPTIONS_FETCH_BODY_STREAM = 1<<2,
MAPI_OPTIONS_FETCH_GENERIC_STREAMS = 1<<3,
- MAPI_OPTIONS_DONT_SUBMIT = 1<<4
+ MAPI_OPTIONS_DONT_SUBMIT = 1<<4,
+ MAPI_OPTIONS_GETBESTBODY = 1<<5
} ExchangeMapiOptions;
#define MAPI_OPTIONS_FETCH_ALL MAPI_OPTIONS_FETCH_ATTACHMENTS | \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]