From 50c50fee4349fbc6be2c4ae702f2f4bcd4714745 Mon Sep 17 00:00:00 2001 From: Matthew Loper Date: Fri, 31 Mar 2000 21:58:19 +0000 Subject: Added "convert_newlines_to_br" boolean param, to give the option of not * camel-formatter.c (text_to_html): Added "convert_newlines_to_br" boolean param, to give the option of not converting '\n's to
tags. This way, when we stick stuff in a
 tag, newlines stay
	newlines.

svn path=/trunk/; revision=2270
---
 camel/camel-formatter.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

(limited to 'camel/camel-formatter.c')

diff --git a/camel/camel-formatter.c b/camel/camel-formatter.c
index 1bfbbcf0a7..5b68cc858d 100644
--- a/camel/camel-formatter.c
+++ b/camel/camel-formatter.c
@@ -74,7 +74,8 @@ static void handle_unknown_type         (CamelFormatter *formatter,
  * so '<' turns into '<', and '"' turns into '"' */
 static gchar* text_to_html (const guchar *input,
 			    guint len,
-			    guint *encoded_len_return);
+			    guint *encoded_len_return,
+			    gboolean convert_newlines_to_br);
 
 /* compares strings case-insensitively */
 static gint strcase_equal (gconstpointer v, gconstpointer v2);
@@ -373,8 +374,9 @@ call_handler_function (CamelFormatter* formatter,
  * - It has also been altered to turn '\n' into 
. */ static gchar * text_to_html (const guchar *input, - guint len, - guint *encoded_len_return) + guint len, + guint *encoded_len_return, + gboolean convert_newlines_to_br) { const guchar *cur = input; guchar *buffer = NULL; @@ -438,7 +440,7 @@ text_to_html (const guchar *input, } /* turn newlines into
*/ - if (*cur == '\n') { + if (*cur == '\n' && convert_newlines_to_br) { *out++ = '<'; *out++ = 'b'; *out++ = 'r'; @@ -464,7 +466,7 @@ write_field_to_stream (const gchar* description, const gchar* value, gchar *s; guint ev_length; gchar* encoded_value = value?text_to_html ( - value, strlen(value), &ev_length):g_strdup (""); + value, strlen(value), &ev_length, TRUE):g_strdup (""); int i; if (value) @@ -675,7 +677,8 @@ handle_text_plain (CamelFormatter *formatter, CamelDataWrapper *wrapper) /* replace '<' with '<', etc. */ text = text_to_html (tmp_buffer, nb_bytes_read, - &returned_strlen); + &returned_strlen, + FALSE); camel_stream_write_string (formatter->priv->stream, text); g_free (text); -- cgit v1.2.3