aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorMatthew Loper <mloper@src.gnome.org>2000-04-01 05:58:19 +0800
committerMatthew Loper <mloper@src.gnome.org>2000-04-01 05:58:19 +0800
commit50c50fee4349fbc6be2c4ae702f2f4bcd4714745 (patch)
treec583a3b71167582ff948365b037d1820588d6cea /camel
parent7e4f187a1034cc352278f0fa5c3ca0321dbda4cc (diff)
downloadgsoc2013-evolution-50c50fee4349fbc6be2c4ae702f2f4bcd4714745.tar.gz
gsoc2013-evolution-50c50fee4349fbc6be2c4ae702f2f4bcd4714745.tar.zst
gsoc2013-evolution-50c50fee4349fbc6be2c4ae702f2f4bcd4714745.zip
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 <br> tags. This way, when we stick stuff in a <pre> tag, newlines stay newlines. svn path=/trunk/; revision=2270
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/camel-formatter.c15
2 files changed, 16 insertions, 6 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 8978f68df3..f6172a9198 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,10 @@
+2000-03-31 Matt Loper <matt@helixcode.com>
+
+ * camel-formatter.c (text_to_html): Added "convert_newlines_to_br"
+ boolean param, to give the option of not converting '\n's to <br>
+ tags. This way, when we stick stuff in a <pre> tag, newlines stay
+ newlines.
+
2000-03-30 Matt Loper <matt@helixcode.com>
* camel-formatter.c (handle_text_plain): Use <pre> tag to force
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 '&lt;', and '"' turns into '&quot;' */
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 <br>. */
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 <br> */
- 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 '&lt;', 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);