[evolution] Bug #674248 - Lost new lines from text/plain



commit 3fbbdd80ac987f2b9ac0b91b7fd16098bb3240c1
Author: Dan VrÃtil <dvratil redhat com>
Date:   Thu Apr 19 09:20:07 2012 +0200

    Bug #674248 - Lost new lines from text/plain

 composer/e-msg-composer.c   |   10 ++++++++--
 em-format/em-format-quote.c |   24 +++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 3 deletions(-)
---
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 5c91037..f033e9d 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -188,6 +188,9 @@ emcu_part_to_html (CamelSession *session,
 	CamelStreamMem *mem;
 	GByteArray *buf;
 	gchar *text;
+	EMFormatParserInfo p_info = { 0 };
+	EMFormatWriterInfo w_info = { 0 };
+	GString *part_id;
 
 	buf = g_byte_array_new ();
 	mem = (CamelStreamMem *) camel_stream_mem_new ();
@@ -208,8 +211,11 @@ emcu_part_to_html (CamelSession *session,
 				(EMFormat *) emfq, em_format_get_charset (source));
 	}
 
-	em_format_format_text (EM_FORMAT (emfq),
-			CAMEL_STREAM (mem), CAMEL_DATA_WRAPPER (part), cancellable);
+	part_id = g_string_sized_new (0);
+	em_format_parse_part (EM_FORMAT (emfq), part, part_id, &p_info, cancellable);
+	em_format_write (EM_FORMAT (emfq), CAMEL_STREAM (mem), &w_info, cancellable);
+	g_string_free (part_id, TRUE);
+
 	g_object_unref (emfq);
 
 	camel_stream_write((CamelStream *) mem, "", 1, cancellable, NULL);
diff --git a/em-format/em-format-quote.c b/em-format/em-format-quote.c
index 2ee8ddb..c323178 100644
--- a/em-format/em-format-quote.c
+++ b/em-format/em-format-quote.c
@@ -523,6 +523,24 @@ emfq_write_attachment (EMFormat *emf,
 }
 
 static void
+emfq_write (EMFormat *emf,
+	    CamelStream *stream,
+	    EMFormatWriterInfo *info,
+	    GCancellable *cancellable)
+{
+	GList *iter;
+
+	for (iter = emf->mail_part_list; iter; iter = iter->next) {
+
+		EMFormatPURI *puri = iter->data;
+		if (!puri || !puri->write_func)
+			continue;
+
+		puri->write_func (emf, puri, stream, info, cancellable);
+	}
+}
+
+static void
 emfq_base_init (EMFormatQuoteClass *klass)
 {
 	emfq_builtin_init (klass);
@@ -532,10 +550,14 @@ static void
 emfq_class_init (EMFormatQuoteClass *klass)
 {
 	GObjectClass *object_class;
+	EMFormatClass *format_class;
 
 	parent_class = g_type_class_peek_parent (klass);
 	g_type_class_add_private (klass, sizeof (EMFormatQuotePrivate));
 
+	format_class = EM_FORMAT_CLASS (klass);
+	format_class->write = emfq_write;
+
 	object_class = G_OBJECT_CLASS (klass);
 	object_class->dispose = emfq_dispose;
 	object_class->finalize = emfq_finalize;
@@ -550,7 +572,7 @@ emfq_init (EMFormatQuote *emfq)
 	emfq->priv->text_html_flags =
 		CAMEL_MIME_FILTER_TOHTML_PRE |
 		CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS |
-		CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;
+		CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES;		
 }
 
 GType



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