From f6f8e3c3e8273c8eedbfb27019912d7a575aa321 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 10 May 2001 20:43:50 +0000 Subject: If we are creating a message with only a single part (ie no attachments 2001-05-10 Jeffrey Stedfast * e-msg-composer.c (build_message): If we are creating a message with only a single part (ie no attachments and we will not be signing/encrypting the part) then `part = CAMEL_MIME_PART(message)` otherwise create a new MIME part and set it's content-object as the message's content-object at a later date. svn path=/trunk/; revision=9749 --- composer/ChangeLog | 8 ++++++++ composer/e-msg-composer.c | 19 ++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/composer/ChangeLog b/composer/ChangeLog index d336e68c5d..07a3ad90ec 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,11 @@ +2001-05-10 Jeffrey Stedfast + + * e-msg-composer.c (build_message): If we are creating a message + with only a single part (ie no attachments and we will not be + signing/encrypting the part) then `part = CAMEL_MIME_PART(message)` + otherwise create a new MIME part and set it's content-object as the + message's content-object at a later date. + 2001-05-09 Jeffrey Stedfast * e-msg-composer.c (add_inlined_image): Don't wrap content-id with diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 01c28dabb0..bfa11d0507 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -412,7 +412,11 @@ build_message (EMsgComposer *composer) camel_object_unref (CAMEL_OBJECT (body)); break; case MSG_FORMAT_PLAIN: - part = camel_mime_part_new (); + /* FIXME: this is just evil... */ + if (!(composer->pgp_sign || composer->pgp_encrypt)) + part = CAMEL_MIME_PART (new); + else + part = camel_mime_part_new (); content_type = best_content (plain); camel_mime_part_set_content (CAMEL_MIME_PART (part), plain, strlen (plain), content_type); @@ -482,15 +486,20 @@ build_message (EMsgComposer *composer) goto exception; } - camel_medium_set_content_object (CAMEL_MEDIUM (new), - camel_medium_get_content_object (CAMEL_MEDIUM (part))); - camel_object_unref (CAMEL_OBJECT (part)); + /* set the toplevel mime part of the message */ + if (part != CAMEL_MIME_PART (new)) { + camel_medium_set_content_object (CAMEL_MEDIUM (new), + camel_medium_get_content_object (CAMEL_MEDIUM (part))); + camel_object_unref (CAMEL_OBJECT (part)); + } return new; exception: - camel_object_unref (CAMEL_OBJECT (part)); + if (part != CAMEL_MIME_PART (new)) + camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (CAMEL_OBJECT (new)); if (camel_exception_is_set (&ex)) { -- cgit v1.2.3