From 7c164f12b9ae13cd2f7e068b1b8626701ab8390f Mon Sep 17 00:00:00 2001 From: Bertrand Guiheneuf Date: Mon, 6 Mar 2000 09:38:42 +0000 Subject: More changes than a man can remember. The UI works now. svn path=/trunk/; revision=2074 --- camel/camel-formatter.c | 79 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 25 deletions(-) (limited to 'camel/camel-formatter.c') diff --git a/camel/camel-formatter.c b/camel/camel-formatter.c index 277de3956d..3ab86b7435 100644 --- a/camel/camel-formatter.c +++ b/camel/camel-formatter.c @@ -462,20 +462,22 @@ 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):""; + value, strlen(value), &ev_length):g_strdup (""); int i; - for (i = 0; i < strlen (value); i++) - if (!isprint(encoded_value[i])) - encoded_value[i] = 'Z'; - g_assert (description && value); + if (value) + for (i = 0; i < strlen (value); i++) + if (!isprint(encoded_value[i])) + encoded_value[i] = 'Z'; + + g_assert (description); s = g_strdup_printf ("%s%s%s%s%s\n", as_table_row?"":"", description, as_table_row?"":" ", encoded_value, - as_table_row?"":"
"); + as_table_row?"":""); camel_stream_write_string (stream, s); g_free (encoded_value); @@ -523,45 +525,70 @@ write_header_info_to_stream (CamelMimeMessage* mime_message, g_assert (mime_message && stream); - camel_stream_write_string (stream, ""); + camel_stream_write_string (stream, "
"); /* A few fields will probably be available from the mime_message; for each one that's available, write it to the output stream with a helper function, 'write_field_to_stream'. */ - if ((s = (gchar*)camel_mime_message_get_subject (mime_message))) { - write_field_to_stream ("Subject: ", s, stream, TRUE); - } - - if ((s = (gchar*)camel_mime_message_get_from (mime_message))) { - write_field_to_stream ("From: ", s, stream, TRUE); - } - if ((s = (gchar*)camel_mime_message_get_received_date (mime_message))) { - write_field_to_stream ("Received Date: ", s, stream, TRUE); - } + /* blame me for the bad code - rhon rhon ! */ + /* first row : "From" and "To" */ + camel_stream_write_string (stream, ""); + camel_stream_write_string (stream, ""); + camel_stream_write_string (stream, ""); + camel_stream_write_string (stream, ""); + + + + /* second row : "Subject" and "CC" */ + camel_stream_write_string (stream, ""); + camel_stream_write_string (stream, ""); + camel_stream_write_string (stream, ""); + camel_stream_write_string (stream, ""); + + +#if FOR_LATER_EXTENSION + if ((s = (gchar*)camel_mime_message_get_received_date (mime_message))) { + write_field_to_stream ("Received Date: ", s, stream, TRUE); + } + + if ((s = (gchar*)camel_mime_message_get_sent_date (mime_message))) { + write_field_to_stream ("Sent Date: ", s, stream, TRUE); + } + + /* Fill out the "BCC:" recipients line */ recipients = camel_mime_message_get_recipients ( mime_message, CAMEL_RECIPIENT_TYPE_BCC); if (recipients) write_recipients_to_stream ("BCC:", recipients, stream, TRUE); +#endif camel_stream_write_string (stream, "
"); + s = (gchar*)camel_mime_message_get_from (mime_message); + write_field_to_stream ("From: ", s, stream, FALSE); + + camel_stream_write_string (stream, ""); - if ((s = (gchar*)camel_mime_message_get_sent_date (mime_message))) { - write_field_to_stream ("Sent Date: ", s, stream, TRUE); - } - /* Fill out the "To:" recipients line */ recipients = camel_mime_message_get_recipients ( mime_message, CAMEL_RECIPIENT_TYPE_TO); if (recipients) - write_recipients_to_stream ("To:", recipients, stream, TRUE); + write_recipients_to_stream ("To:", recipients, stream, FALSE); + camel_stream_write_string (stream, "
"); + s = (gchar*)camel_mime_message_get_subject (mime_message); + write_field_to_stream ("Subject: ", s, stream, FALSE); + + camel_stream_write_string (stream, ""); + /* Fill out the "CC:" recipients line */ recipients = camel_mime_message_get_recipients ( mime_message, CAMEL_RECIPIENT_TYPE_CC); if (recipients) - write_recipients_to_stream ("CC:", recipients, stream, TRUE); + write_recipients_to_stream ("CC:", recipients, stream, FALSE); + + camel_stream_write_string (stream, "
"); } @@ -633,7 +660,7 @@ handle_text_plain (CamelFormatter *formatter, CamelDataWrapper *wrapper) nb_bytes_read = camel_stream_read (wrapper_output_stream, tmp_buffer, 4096); - + /* If there's any text, write it to the stream */ if (nb_bytes_read > 0) { @@ -838,7 +865,9 @@ print_camel_body_part (CamelMimeBodyPart* body_part, call_handler_function (formatter, contents, MIME_TYPE_WHOLE (body_part), MIME_TYPE_MAIN (body_part)); - camel_stream_write_string (formatter->priv->stream, "\n
\n"); + camel_stream_write_string (formatter->priv->stream, "\n\n"); + /* use this when gtktmhl is fixed */ + /* camel_stream_write_string (formatter->priv->stream, "\n
\n"); */ } -- cgit v1.2.3