[evolution/gnome-3-4] Bug #667046 - Outgoing filter cannot override used Sent folder



commit 156954e8b6b9cfaba196e25ed69f2f0210c76a4c
Author: Milan Crha <mcrha redhat com>
Date:   Tue Apr 17 15:25:21 2012 +0200

    Bug #667046 - Outgoing filter cannot override used Sent folder

 libemail-engine/e-mail-session-utils.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index 6aa090e..27373f1 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. */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]