From 4987ad911811d29763c1c949d286b3eb4f71d22c Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Mon, 5 Jun 2000 21:14:48 +0000 Subject: Update for new composer attachment interface. * mail-format.c (mail_generate_forward): Update for new composer attachment interface. svn path=/trunk/; revision=3431 --- mail/mail-format.c | 45 ++++++++++----------------------------------- 1 file changed, 10 insertions(+), 35 deletions(-) (limited to 'mail/mail-format.c') 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 -#include -#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? */ -- cgit v1.2.3