aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog5
-rw-r--r--mail/mail-format.c45
2 files changed, 15 insertions, 35 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index eba81e5036..18f881aca6 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,8 @@
+2000-06-05 Dan Winship <danw@helixcode.com>
+
+ * mail-format.c (mail_generate_forward): Update for new composer
+ attachment interface.
+
2000-06-02 Jeffrey Stedfast <fejj@helixcode.com>
* mail-config.c (providers_config_new): Added a new notebook
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? */