[evolution-mapi/gnome-2-28] Bug #561794 - Store sent messages in Sent Items, not Outbox
- From: Milan Crha <mcrha src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution-mapi/gnome-2-28] Bug #561794 - Store sent messages in Sent Items, not Outbox
- Date: Wed, 25 Nov 2009 11:58:21 +0000 (UTC)
commit 81e6266bc886a8b9168823470f78e94f1f144392
Author: Milan Crha <mcrha redhat com>
Date: Wed Nov 25 12:57:55 2009 +0100
Bug #561794 - Store sent messages in Sent Items, not Outbox
src/calendar/e-cal-backend-mapi.c | 4 ++--
src/camel/camel-mapi-folder.c | 2 +-
src/camel/camel-mapi-transport.c | 4 ++--
src/libexchangemapi/exchange-mapi-connection.c | 16 ++++++++++++++++
src/libexchangemapi/exchange-mapi-connection.h | 3 ++-
5 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/src/calendar/e-cal-backend-mapi.c b/src/calendar/e-cal-backend-mapi.c
index 2c04ae6..8f01282 100644
--- a/src/calendar/e-cal-backend-mapi.c
+++ b/src/calendar/e-cal-backend-mapi.c
@@ -1850,10 +1850,10 @@ e_cal_backend_mapi_send_objects (ECalBackendSync *backend, EDataCal *cal, const
cbdata.get_timezone = (icaltimezone * (*)(gpointer data, const gchar *tzid)) e_cal_backend_mapi_internal_get_timezone;
cbdata.get_tz_data = cbmapi;
- mid = exchange_mapi_create_item (olFolderOutbox, 0,
+ mid = exchange_mapi_create_item (olFolderSentMail, 0,
exchange_mapi_cal_util_build_name_id, GINT_TO_POINTER(kind),
exchange_mapi_cal_util_build_props, &cbdata,
- recipients, attachments, streams, 0);
+ recipients, attachments, streams, MAPI_OPTIONS_DELETE_ON_SUBMIT_FAILURE);
g_free (cbdata.props);
if (!mid) {
g_object_unref (comp);
diff --git a/src/camel/camel-mapi-folder.c b/src/camel/camel-mapi-folder.c
index ab4b12b..a48a90e 100644
--- a/src/camel/camel-mapi-folder.c
+++ b/src/camel/camel-mapi-folder.c
@@ -2004,7 +2004,7 @@ mapi_append_message (CamelFolder *folder, CamelMimeMessage *message,
item = camel_mapi_utils_mime_to_item (message, from, recipients, ex);
- mid = exchange_mapi_create_item (olFolderOutbox, fid, NULL, NULL,
+ mid = exchange_mapi_create_item (-1, fid, NULL, NULL,
camel_mapi_utils_create_item_build_props, item,
item->recipients, item->attachments,
item->generic_streams, 0);
diff --git a/src/camel/camel-mapi-transport.c b/src/camel/camel-mapi-transport.c
index 1bef7de..323dd8b 100644
--- a/src/camel/camel-mapi-transport.c
+++ b/src/camel/camel-mapi-transport.c
@@ -84,10 +84,10 @@ mapi_message_item_send (MapiItem *item)
guint64 fid = 0;
mapi_id_t mid = 0;
- mid = exchange_mapi_create_item (olFolderOutbox, fid, NULL, NULL,
+ mid = exchange_mapi_create_item (olFolderSentMail, fid, NULL, NULL,
camel_mapi_utils_create_item_build_props,
item, item->recipients,
- item->attachments, item->generic_streams, 0);
+ item->attachments, item->generic_streams, MAPI_OPTIONS_DELETE_ON_SUBMIT_FAILURE);
return mid;
}
diff --git a/src/libexchangemapi/exchange-mapi-connection.c b/src/libexchangemapi/exchange-mapi-connection.c
index 49ee2fd..38f7026 100644
--- a/src/libexchangemapi/exchange-mapi-connection.c
+++ b/src/libexchangemapi/exchange-mapi-connection.c
@@ -2148,6 +2148,22 @@ exchange_mapi_create_item (uint32_t olFolder, mapi_id_t fid,
retval = SubmitMessage(&obj_message);
if (retval != MAPI_E_SUCCESS) {
mapi_errstr("SubmitMessage", GetLastError());
+
+ if ((options & MAPI_OPTIONS_DELETE_ON_SUBMIT_FAILURE) != 0) {
+ mid = mapi_object_get_id (&obj_message);
+ mapi_object_release(&obj_message);
+ /* to not release a message object twice */
+ mapi_object_init (&obj_message);
+
+ retval = DeleteMessage (&obj_folder, &mid, 1);
+ if (retval != MAPI_E_SUCCESS) {
+ mapi_errstr ("DeleteMessage", GetLastError ());
+ }
+
+ /* do not forget to set it back to 0, as the function failed */
+ mid = 0;
+ }
+
goto cleanup;
}
}
diff --git a/src/libexchangemapi/exchange-mapi-connection.h b/src/libexchangemapi/exchange-mapi-connection.h
index b2db6a8..8a2e0bb 100644
--- a/src/libexchangemapi/exchange-mapi-connection.h
+++ b/src/libexchangemapi/exchange-mapi-connection.h
@@ -38,7 +38,8 @@ typedef enum {
MAPI_OPTIONS_DONT_SUBMIT = 1<<5,
MAPI_OPTIONS_GETBESTBODY = 1<<6,
MAPI_OPTIONS_USE_PFSTORE = 1<<7,
- MAPI_OPTIONS_DONT_OPEN_MESSAGE = 1<<8
+ MAPI_OPTIONS_DONT_OPEN_MESSAGE = 1<<8,
+ MAPI_OPTIONS_DELETE_ON_SUBMIT_FAILURE = 1<<9
} ExchangeMAPIOptions;
#define MAPI_OPTIONS_FETCH_ALL MAPI_OPTIONS_FETCH_ATTACHMENTS | \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]