diff options
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-format.c | 45 | ||||
-rw-r--r-- | mail/mail-ops.c | 57 | ||||
-rw-r--r-- | mail/mail.h | 4 |
4 files changed, 63 insertions, 51 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 90fd806534..5651f9de24 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2000-07-08 Dan Winship <danw@helixcode.com> + + * mail-ops.c (forward_msg): Deal with having multiple selected + messages. + + * mail-format.c (mail_generate_forward): Removed. (Integrated into + forward_msg) + 2000-07-08 Jeffrey Stedfast <fejj@helixcode.com> * message-list.c (build_tree): Small fix to stop uid data from diff --git a/mail/mail-format.c b/mail/mail-format.c index 909eced8ca..56f361aebf 100644 --- a/mail/mail-format.c +++ b/mail/mail-format.c @@ -1437,48 +1437,3 @@ mail_generate_reply (CamelMimeMessage *message, gboolean to_all) return composer; } - -EMsgComposer * -mail_generate_forward (CamelMimeMessage *mime_message, - gboolean forward_as_attachment, - gboolean keep_attachments) -{ - EMsgComposer *composer; - CamelMimePart *part; - const char *from, *subject; - char *fwd_subj; - - if (!forward_as_attachment) - g_warning ("Forward as non-attachment not implemented."); - if (!keep_attachments) - g_warning ("Forwarding without attachments not implemented."); - - composer = E_MSG_COMPOSER (e_msg_composer_new ()); - - part = camel_mime_part_new (); - camel_mime_part_set_disposition (part, "inline"); - camel_mime_part_set_description (part, "forwarded message"); - camel_medium_set_content_object (CAMEL_MEDIUM (part), - CAMEL_DATA_WRAPPER (mime_message)); - camel_mime_part_set_content_type (part, "message/rfc822"); - - e_msg_composer_attach (composer, part); - gtk_object_unref (GTK_OBJECT (part)); - - from = camel_mime_message_get_from (mime_message); - subject = camel_mime_message_get_subject (mime_message); - if (from) { - if (subject && *subject) { - while (*subject == ' ') - subject++; - fwd_subj = g_strdup_printf ("[%s] %s", from, subject); - } else { - fwd_subj = g_strdup_printf ("[%s] (forwarded message)", - from); - } - } - e_msg_composer_set_headers (composer, NULL, NULL, NULL, fwd_subj); - g_free (fwd_subj); - - return composer; -} diff --git a/mail/mail-ops.c b/mail/mail-ops.c index 0f92674d45..ee1da537ef 100644 --- a/mail/mail-ops.c +++ b/mail/mail-ops.c @@ -609,18 +609,71 @@ reply_to_all (GtkWidget *button, gpointer user_data) reply (FOLDER_BROWSER (user_data), TRUE); } +static void +attach_msg (MessageList *ml, const char *uid, gpointer data) +{ + EMsgComposer *composer = data; + CamelMimeMessage *message; + CamelMimePart *part; + const char *subject; + char *desc; + + message = camel_folder_get_message (ml->folder, uid, NULL); + if (!message) + return; + subject = camel_mime_message_get_subject (message); + if (subject) + desc = g_strdup_printf ("Forwarded message - %s", subject); + else + desc = g_strdup ("Forwarded message"); + + part = camel_mime_part_new (); + camel_mime_part_set_disposition (part, "inline"); + camel_mime_part_set_description (part, desc); + camel_medium_set_content_object (CAMEL_MEDIUM (part), + CAMEL_DATA_WRAPPER (message)); + camel_mime_part_set_content_type (part, "message/rfc822"); + + e_msg_composer_attach (composer, part); + + gtk_object_unref (GTK_OBJECT (part)); + gtk_object_unref (GTK_OBJECT (message)); + g_free (desc); +} + void forward_msg (GtkWidget *button, gpointer user_data) { FolderBrowser *fb; EMsgComposer *composer; + CamelMimeMessage *cursor_msg; + const char *from, *subject; + char *fwd_subj; if (!check_configured ()) return; fb = FOLDER_BROWSER (user_data); - composer = mail_generate_forward (fb->mail_display->current_message, - TRUE, TRUE); + + composer = E_MSG_COMPOSER (e_msg_composer_new ()); + message_list_foreach (fb->message_list, attach_msg, composer); + + cursor_msg = fb->mail_display->current_message; + + from = camel_mime_message_get_from (cursor_msg); + subject = camel_mime_message_get_subject (cursor_msg); + if (from) { + if (subject && *subject) { + while (*subject == ' ') + subject++; + fwd_subj = g_strdup_printf ("[%s] %s", from, subject); + } else { + fwd_subj = g_strdup_printf ("[%s] (forwarded message)", + from); + } + } + e_msg_composer_set_headers (composer, NULL, NULL, NULL, fwd_subj); + g_free (fwd_subj); gtk_signal_connect (GTK_OBJECT (composer), "send", GTK_SIGNAL_FUNC (composer_send_cb), NULL); diff --git a/mail/mail.h b/mail/mail.h index 38412d972b..788bb579bf 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -42,10 +42,6 @@ void mail_format_mime_message (CamelMimeMessage *mime_message, EMsgComposer *mail_generate_reply (CamelMimeMessage *mime_message, gboolean to_all); -EMsgComposer *mail_generate_forward (CamelMimeMessage *mime_message, - gboolean forward_as_attachment, - gboolean keep_attachments); - /* mail-identify */ char *mail_identify_mime_part (CamelMimePart *part); |