aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-08-07 16:37:59 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-08-07 16:37:59 +0800
commita7efe01005ea34fcf3f6128953cc55a5e829aa3d (patch)
tree1f336cb80301755d61a25c03bfa7cd8059a7da20
parentcf0a938afbc1c1622111bfd249e0bba75eea3033 (diff)
downloadgsoc2013-evolution-a7efe01005ea34fcf3f6128953cc55a5e829aa3d.tar.gz
gsoc2013-evolution-a7efe01005ea34fcf3f6128953cc55a5e829aa3d.tar.zst
gsoc2013-evolution-a7efe01005ea34fcf3f6128953cc55a5e829aa3d.zip
Added code to set the body text based on the CamelMimeMessage.
2000-08-07 Jeffrey Stedfast <fejj@helixcode.com> * 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
-rw-r--r--composer/ChangeLog6
-rw-r--r--composer/e-msg-composer.c55
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,5 +1,11 @@
2000-08-07 Jeffrey Stedfast <fejj@helixcode.com>
+ * 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 <fejj@helixcode.com>
+
* e-msg-composer.c (do_exit): Prompt the user to save their
composition in Drafts.
(set_editor_text): Uhm, use "-- \n" not "--\n" because the space
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 <camel/camel.h>
+#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<BR>\n<PRE>\n%s</PRE>",
+ fulltext = g_strdup_printf ("%s<br>\n<pre>\n%s</pre>",
text, sig);
else
- fulltext = g_strdup_printf ("%s<BR>\n<PRE>\n-- \n%s</PRE>",
+ fulltext = g_strdup_printf ("%s<br>\n<pre>\n-- \n%s</pre>",
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;
}