aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-format.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/mail-format.c')
-rw-r--r--mail/mail-format.c45
1 files changed, 10 insertions, 35 deletions
diff --git a/mail/mail-format.c b/mail/mail-format.c
index 85745c6755..8c1f6c3088 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -1401,55 +1401,30 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all)
return composer;
}
-/* This is part of the temporary kludge below. */
-#ifndef HAVE_MKSTEMP
-#include <fcntl.h>
-#include <sys/stat.h>
-#endif
-
EMsgComposer *
mail_generate_forward (CamelMimeMessage *mime_message,
gboolean forward_as_attachment,
gboolean keep_attachments)
{
EMsgComposer *composer;
- char *tmpfile;
- int fd;
- CamelStream *stream;
+ CamelMimePart *part;
if (!forward_as_attachment)
g_warning ("Forward as non-attachment not implemented.");
if (!keep_attachments)
g_warning ("Forwarding without attachments not implemented.");
- /* For now, we kludge by writing out a temp file. Later,
- * EMsgComposer will support attaching CamelMimeParts directly,
- * or something. FIXME.
- */
- tmpfile = g_strdup ("/tmp/evolution-kludge-XXXXXX");
-#ifdef HAVE_MKSTEMP
- fd = mkstemp (tmpfile);
-#else
- if (mktemp (tmpfile)) {
- fd = open (tmpfile, O_RDWR | O_CREAT | O_EXCL,
- S_IRUSR | S_IWUSR);
- } else
- fd = -1;
-#endif
- if (fd == -1) {
- g_warning ("Couldn't create temp file for forwarding");
- g_free (tmpfile);
- return NULL;
- }
+ composer = E_MSG_COMPOSER (e_msg_composer_new ());
- stream = camel_stream_fs_new_with_fd (fd);
- camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (mime_message), stream);
- camel_stream_flush (stream);
- gtk_object_unref (GTK_OBJECT (stream));
+ part = camel_mime_part_new ();
+ camel_mime_part_set_disposition (part, "inline");
+ camel_mime_part_set_description (part, "forwarded message");
+ camel_medium_set_content_object (CAMEL_MEDIUM (part),
+ CAMEL_DATA_WRAPPER (mime_message));
+ camel_mime_part_set_content_type (part, "message/rfc822");
- composer = E_MSG_COMPOSER (e_msg_composer_new ());
- e_msg_composer_attachment_bar_attach (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), tmpfile);
- g_free (tmpfile);
+ e_msg_composer_attach (composer, part);
+ gtk_object_unref (GTK_OBJECT (part));
/* FIXME: should we default a subject? */