From 9f81c2c796e9e93d643eed11d9e6f7d31a9eb4d8 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Wed, 26 Apr 2000 21:52:13 +0000 Subject: Only generate a multipart message if there are attachments. Otherwise * e-msg-composer.c (build_message): Only generate a multipart message if there are attachments. Otherwise generate a single part. svn path=/trunk/; revision=2648 --- composer/e-msg-composer.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'composer/e-msg-composer.c') diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 81423f39d3..d404146351 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -136,7 +136,6 @@ build_message (EMsgComposer *composer) { CamelMimeMessage *new; CamelMimePart *part; - CamelMultipart *multipart; char *text; int i; @@ -150,21 +149,24 @@ build_message (EMsgComposer *composer) composer->extra_hdr_values->pdata[i]); } - multipart = camel_multipart_new (); part = camel_mime_part_new (); - text = get_editor_text (BONOBO_WIDGET (composer->editor)); camel_mime_part_set_content (part, text, strlen (text), "text/html"); g_free (text); - camel_multipart_add_part (multipart, part); + if (e_msg_composer_attachment_bar_get_num_attachments (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar))) { + CamelMultipart *multipart = camel_multipart_new (); - e_msg_composer_attachment_bar_to_multipart - (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), - multipart); + camel_multipart_add_part (multipart, part); + + e_msg_composer_attachment_bar_to_multipart (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), multipart); - camel_medium_set_content_object (CAMEL_MEDIUM (new), - CAMEL_DATA_WRAPPER (multipart)); + camel_medium_set_content_object (CAMEL_MEDIUM (new), + CAMEL_DATA_WRAPPER (multipart)); + } else { + camel_medium_set_content_object (CAMEL_MEDIUM (new), + CAMEL_DATA_WRAPPER (part)); + } /* FIXME refcounting is most certainly wrong. We want all the stuff to be destroyed when we unref() the message. */ -- cgit