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
This commit is contained in:
Jeffrey Stedfast
2000-12-07 23:41:59 +00:00
committed by Jeffrey Stedfast
parent 640883f04d
commit cec18e26aa
3 changed files with 47 additions and 8 deletions

View File

@ -1,3 +1,13 @@
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.
2000-12-07 Dan Winship <danw@helixcode.com>
* mail-display.c (on_object_requested): Make the iTip hack spew a

View File

@ -488,7 +488,7 @@ forward_message (FolderBrowser *fb, gboolean attach)
cursor_msg = fb->mail_display->current_message;
g_return_if_fail (cursor_msg != NULL);
if (!check_send_configuration (fb))
return;
@ -496,8 +496,11 @@ forward_message (FolderBrowser *fb, gboolean attach)
if (!composer)
return;
uids = g_ptr_array_new();
message_list_foreach (fb->message_list, enumerate_msg, uids);
uids = g_ptr_array_new ();
if (attach)
message_list_foreach (fb->message_list, enumerate_msg, uids);
else
g_ptr_array_add (uids, fb->message_list->cursor_uid);
gtk_signal_connect (GTK_OBJECT (composer), "send",
GTK_SIGNAL_FUNC (composer_send_cb), NULL);

View File

@ -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;