From a7efe01005ea34fcf3f6128953cc55a5e829aa3d Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Mon, 7 Aug 2000 08:37:59 +0000 Subject: Added code to set the body text based on the CamelMimeMessage. 2000-08-07 Jeffrey Stedfast * e-msg-composer.c (e_msg_composer_new_with_message): Added code to set the body text based on the CamelMimeMessage. (set_editor_text): Use lowercase html tags... svn path=/trunk/; revision=4565 --- composer/ChangeLog | 6 ++++++ composer/e-msg-composer.c | 55 +++++++++++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index dc490887dd..446240f0ff 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,9 @@ +2000-08-07 Jeffrey Stedfast + + * e-msg-composer.c (e_msg_composer_new_with_message): Added code + to set the body text based on the CamelMimeMessage. + (set_editor_text): Use lowercase html tags... + 2000-08-07 Jeffrey Stedfast * e-msg-composer.c (do_exit): Prompt the user to save their diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index f867be4c94..2e50a9029f 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -44,6 +44,8 @@ #include +#include "../mail/mail.h" + #include "e-util/e-html-utils.h" #include "e-util/e-setup.h" #include "e-util/e-gui-utils.h" @@ -71,6 +73,10 @@ static guint signals[LAST_SIGNAL] = { 0 }; static GnomeAppClass *parent_class = NULL; +/* local prototypes */ +static GList *add_recipients (GList *list, const char *recips, gboolean decode); +static void free_recipients (GList *list); + static GtkWidget * create_editor (EMsgComposer *composer) @@ -364,10 +370,10 @@ set_editor_text (BonoboWidget *editor, const char *sig_file, const char *text) sig = get_signature (sig_file); if (sig) { if (!strncmp ("-- \n", sig, 3)) - fulltext = g_strdup_printf ("%s
\n
\n%s
", + fulltext = g_strdup_printf ("%s
\n
\n%s
", text, sig); else - fulltext = g_strdup_printf ("%s
\n
\n-- \n%s
", + fulltext = g_strdup_printf ("%s
\n
\n-- \n%s
", text, sig); } else { if (!*text) @@ -1303,9 +1309,13 @@ GtkWidget * e_msg_composer_new_with_message (CamelMimeMessage *msg) { const CamelInternetAddress *to, *cc, *bcc; - GList *tmp, *To = NULL, *Cc = NULL, *Bcc = NULL; + GList *To = NULL, *Cc = NULL, *Bcc = NULL; + gboolean want_plain, is_html; + CamelDataWrapper *contents; + const MailConfig *config; const gchar *subject; GtkWidget *new; + char *text, *final_text; guint len, i; g_return_val_if_fail (gtk_main_level () > 0, NULL); @@ -1345,27 +1355,26 @@ e_msg_composer_new_with_message (CamelMimeMessage *msg) e_msg_composer_set_headers (E_MSG_COMPOSER (new), To, Cc, Bcc, subject); - tmp = To; - while (tmp) { - g_free (tmp->data); - tmp = tmp->next; - } - g_list_free (To); - tmp = Cc; - while (tmp) { - g_free (tmp->data); - tmp = tmp->next; - } - g_list_free (Cc); - tmp = Bcc; - while (tmp) { - g_free (tmp->data); - tmp = tmp->next; - } - g_list_free (Bcc); + free_recipients (To); + free_recipients (Cc); + free_recipients (Bcc); - set_editor_text (BONOBO_WIDGET (E_MSG_COMPOSER (new)->editor), - NULL, "FIXME: like, uh... put the message here and stuff\n"); + config = mail_config_fetch (); + want_plain = !config->send_html; + + contents = camel_medium_get_content_object (CAMEL_MEDIUM (msg)); + text = mail_get_message_body (contents, want_plain, &is_html); + if (is_html) + final_text = g_strdup (text); + else + final_text = e_text_to_html (text, E_TEXT_TO_HTML_CONVERT_NL | + E_TEXT_TO_HTML_CONVERT_SPACES); + g_free (text); + + e_msg_composer_set_body_text (E_MSG_COMPOSER (new), final_text); + + /*set_editor_text (BONOBO_WIDGET (E_MSG_COMPOSER (new)->editor), + NULL, "FIXME: like, uh... put the message here and stuff\n");*/ return new; } -- cgit v1.2.3