From 9e541010cb509af8b6feee624d782a158308ed01 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 17 Apr 2012 15:24:26 +0200 Subject: Bug #667046 - Outgoing filter cannot override used Sent folder --- libemail-engine/e-mail-session-utils.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c index 6aa090e0e4..27373f1610 100644 --- a/libemail-engine/e-mail-session-utils.c +++ b/libemail-engine/e-mail-session-utils.c @@ -506,6 +506,9 @@ mail_session_send_to_thread (GSimpleAsyncResult *simple, error->message); g_clear_error (&error); } + + if ((camel_message_info_flags (context->info) & CAMEL_MESSAGE_DELETED) != 0) + copy_to_sent = FALSE; } if (!copy_to_sent) @@ -632,6 +635,23 @@ exit: g_string_free (error_messages, TRUE); } +static guint32 +get_message_size (CamelMimeMessage *message, + GCancellable *cancellable) +{ + guint32 res = 0; + CamelStream *null; + + g_return_val_if_fail (message != NULL, 0); + + null = camel_stream_null_new (); + camel_data_wrapper_write_to_stream_sync (CAMEL_DATA_WRAPPER (message), null, cancellable, NULL); + res = CAMEL_STREAM_NULL (null)->written; + g_object_unref (null); + + return res; +} + void e_mail_session_send_to (EMailSession *session, CamelMimeMessage *message, @@ -758,7 +778,8 @@ e_mail_session_send_to (EMailSession *session, /* Miscellaneous preparations. */ - info = camel_message_info_new (NULL); + info = camel_message_info_new_from_header (NULL, ((CamelMimePart *) message)->headers); + ((CamelMessageInfoBase *) info)->size = get_message_size (message, cancellable); camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN, ~0); /* The rest of the processing happens in a thread. */ -- cgit