aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-12-08 07:41:59 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-12-08 07:41:59 +0800
commitcec18e26aa44ff984e15fa71fd4dec1c21c4e328 (patch)
tree4865e049032b1a631bcf6d8db8c0cf532396bee0 /mail/mail-ops.c
parent640883f04d9d76a933a2410ef3f100848ad7ddfd (diff)
downloadgsoc2013-evolution-cec18e26aa44ff984e15fa71fd4dec1c21c4e328.tar
gsoc2013-evolution-cec18e26aa44ff984e15fa71fd4dec1c21c4e328.tar.gz
gsoc2013-evolution-cec18e26aa44ff984e15fa71fd4dec1c21c4e328.tar.bz2
gsoc2013-evolution-cec18e26aa44ff984e15fa71fd4dec1c21c4e328.tar.lz
gsoc2013-evolution-cec18e26aa44ff984e15fa71fd4dec1c21c4e328.tar.xz
gsoc2013-evolution-cec18e26aa44ff984e15fa71fd4dec1c21c4e328.tar.zst
gsoc2013-evolution-cec18e26aa44ff984e15fa71fd4dec1c21c4e328.zip
Only do a message_list_foreach if we plan on attaching messages, otherwise
2000-12-07 Jeffrey Stedfast <fejj@helixcode.com> * mail-callbacks.c (forward_message): Only do a message_list_foreach if we plan on attaching messages, otherwise just use ml->cursor_uid. * mail-ops.c (cleanup_forward_messages): If attaching multiple forwarded message, wrap them in a multipart/digest otherwise just attach the single message as a message/rfc822. svn path=/trunk/; revision=6851
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index cb6c0ee671..dd2ad8040a 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1602,6 +1602,7 @@ do_forward_messages (gpointer in_data, gpointer op_data, CamelException *ex)
part = mail_tool_make_message_attachment (message);
if (!part) {
+ camel_object_unref (CAMEL_OBJECT (message));
camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to generate mime part from "
"message while generating forwarded message."));
@@ -1637,13 +1638,38 @@ cleanup_forward_messages (gpointer in_data, gpointer op_data,
forward_messages_data_t *data = (forward_messages_data_t *) op_data;
if (input->attach) {
- int i;
-
- for (i = 0; i < data->parts->len; i++) {
- e_msg_composer_attach (input->composer, data->parts->pdata[i]);
- camel_object_unref (CAMEL_OBJECT (data->parts->pdata[i]));
+ if (data->parts->len > 1) {
+ /* construct and attach a multipart/digest */
+ CamelMimePart *digest;
+ CamelMultipart *multipart;
+ int i;
+
+ multipart = camel_multipart_new ();
+ camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
+ "multipart/digest");
+ camel_multipart_set_boundary (multipart, NULL);
+
+ for (i = 0; i < data->parts->len; i++) {
+ camel_multipart_add_part (multipart, CAMEL_MIME_PART (data->parts->pdata[i]));
+ camel_object_unref (CAMEL_OBJECT (data->parts->pdata[i]));
+ }
+
+ digest = camel_mime_part_new ();
+ camel_medium_set_content_object (CAMEL_MEDIUM (digest),
+ CAMEL_DATA_WRAPPER (multipart));
+ camel_object_unref (CAMEL_OBJECT (multipart));
+
+ camel_mime_part_set_description (digest, _("Forwarded messages"));
+
+ e_msg_composer_attach (input->composer, CAMEL_MIME_PART (digest));
+ camel_object_unref (CAMEL_OBJECT (digest));
+ } else if (data->parts->len == 1) {
+ /* simply attach the message as message/rfc822 */
+ e_msg_composer_attach (input->composer, CAMEL_MIME_PART (data->parts->pdata[0]));
+ camel_object_unref (CAMEL_OBJECT (data->parts->pdata[0]));
}
} else {
+ /* attach as inlined text */
CamelMimeMessage *message = data->parts->pdata[0];
char *text;