aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-10-30 09:36:48 +0800
committerDan Winship <danw@src.gnome.org>2001-10-30 09:36:48 +0800
commit46dee516710185ab5fb881a02580c66f3e82181c (patch)
tree726f24567c51d27580c4f444ee7d7b33b5f5671e /composer/e-msg-composer.c
parente6e77f1fc333b12693989ccbbd9a432465c6ffd6 (diff)
downloadgsoc2013-evolution-46dee516710185ab5fb881a02580c66f3e82181c.tar
gsoc2013-evolution-46dee516710185ab5fb881a02580c66f3e82181c.tar.gz
gsoc2013-evolution-46dee516710185ab5fb881a02580c66f3e82181c.tar.bz2
gsoc2013-evolution-46dee516710185ab5fb881a02580c66f3e82181c.tar.lz
gsoc2013-evolution-46dee516710185ab5fb881a02580c66f3e82181c.tar.xz
gsoc2013-evolution-46dee516710185ab5fb881a02580c66f3e82181c.tar.zst
gsoc2013-evolution-46dee516710185ab5fb881a02580c66f3e82181c.zip
Set the (new) "no_body" flag on the composer.
* evolution-composer.c (init): Set the (new) "no_body" flag on the composer. (impl_Composer_set_body_text): And unset it here. (unset_no_body): And here (called if/when the composer is realized). * e-msg-composer.c (build_message): If the composer has the "no_body" flag set, and a single attachment, promote that attachment to be the message body. svn path=/trunk/; revision=14393
Diffstat (limited to 'composer/e-msg-composer.c')
-rw-r--r--composer/e-msg-composer.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 50c4e608c8..b68d0e871f 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -280,6 +280,21 @@ add_inlined_images (EMsgComposer *composer, CamelMultipart *multipart)
}
}
+static void
+copy_headers (CamelMedium *dest, CamelMedium *src)
+{
+ CamelMediumHeader header;
+ GArray *headers;
+ int i;
+
+ headers = camel_medium_get_headers (src);
+ for (i = 0; i < headers->len; i++) {
+ header = g_array_index (headers, CamelMediumHeader, i);
+ camel_medium_set_header (dest, header.name, header.value);
+ }
+ camel_medium_free_headers (src, headers);
+}
+
/* This functions builds a CamelMimeMessage for the message that the user has
* composed in `composer'.
*/
@@ -299,7 +314,7 @@ build_message (EMsgComposer *composer)
CamelMultipart *body = NULL;
CamelMimePart *part;
CamelException ex;
- int i;
+ int i, num_attachments;
if (composer->persist_stream_interface == CORBA_OBJECT_NIL)
return NULL;
@@ -395,7 +410,8 @@ build_message (EMsgComposer *composer)
} else
current = plain;
- if (e_msg_composer_attachment_bar_get_num_attachments (attachment_bar)) {
+ num_attachments = e_msg_composer_attachment_bar_get_num_attachments (attachment_bar);
+ if (num_attachments) {
CamelMultipart *multipart = camel_multipart_new ();
/* Generate a random boundary. */
@@ -410,8 +426,15 @@ build_message (EMsgComposer *composer)
camel_object_unref (CAMEL_OBJECT (part));
e_msg_composer_attachment_bar_to_multipart (attachment_bar, multipart, composer->charset);
-
- current = CAMEL_DATA_WRAPPER (multipart);
+
+ if (composer->no_body && num_attachments == 1) {
+ part = camel_multipart_get_part (multipart, 1);
+ current = camel_medium_get_content_object (CAMEL_MEDIUM (part));
+ copy_headers (CAMEL_MEDIUM (new), CAMEL_MEDIUM (part));
+ camel_object_ref (CAMEL_OBJECT (current));
+ camel_object_unref (CAMEL_OBJECT (multipart));
+ } else
+ current = CAMEL_DATA_WRAPPER (multipart);
}
if (composer->pgp_sign || composer->pgp_encrypt) {