Thank you, Jeffrey. As you advise, I read the other codes related to message attachment and find that I should set the description but not the filename. So I modified the patch. Please review it. Best Regards Charles Jeffrey Stedfast wrote: you don't want to set the subject as the attachment filename. also, please adhere to our coding standards: char *subject; not char* subject; don't use {}'s if there is only one statement in the then-branch: if (subject) camel_mime_part_set_filename (part, subject); anyways, as I said above - I don't feel setting the filename as the subject makes sense. A message/rfc822 attachment probably shouldn't even have a filename... Jeff On Sat, 2003-12-13 at 05:17, Charles Zhang wrote:Hello all. I attach a patch for bug 47545. This time, I set CamelMimePart's filename at the very place to fix the bug of attachment sometimes being labeled as "attachment". Please seek it. Best Regards Charles Zhang ______________________________________________________________________ Index: composer/ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/composer/ChangeLog,v retrieving revision 1.544.2.16 diff -u -p -r1.544.2.16 ChangeLog --- composer/ChangeLog 6 Oct 2003 17:07:16 -0000 1.544.2.16 +++ composer/ChangeLog 13 Dec 2003 10:11:56 -0000 @@ -0,0 +0,5 @@ +2003-12-13 Charles Zhang <charles zhang sun com> + + *e-msg-composer.c (message_rfc822_dnd): set CamelMimePart filename. + Fixes bug 47545. + Index: composer/e-msg-composer.c =================================================================== RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v retrieving revision 1.395.2.8 diff -u -p -r1.395.2.8 e-msg-composer.c --- composer/e-msg-composer.c 6 Oct 2003 17:07:16 -0000 1.395.2.8 +++ composer/e-msg-composer.c 13 Dec 2003 10:12:19 -0000 @@ -2540,18 +2540,26 @@ message_rfc822_dnd (EMsgComposer *compos while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) { CamelMimeMessage *message; CamelMimePart *part; + char* subject; message = camel_mime_message_new (); if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (message), mp) == -1) { camel_object_unref (message); break; } - + + subject = camel_mime_message_get_subject (message); + part = camel_mime_part_new (); camel_mime_part_set_disposition (part, "inline"); camel_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (message)); camel_mime_part_set_content_type (part, "message/rfc822"); + + if (subject) { + camel_mime_part_set_filename (part, subject); + } + e_msg_composer_attachment_bar_attach_mime_part (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), part); camel_object_unref (message); |
? composer/a.c ? composer/p.diff Index: composer/ChangeLog =================================================================== RCS file: /cvs/gnome/evolution/composer/ChangeLog,v retrieving revision 1.544.2.16 diff -u -p -r1.544.2.16 ChangeLog --- composer/ChangeLog 6 Oct 2003 17:07:16 -0000 1.544.2.16 +++ composer/ChangeLog 22 Dec 2003 11:47:46 -0000 @@ -0,0 +0,5 @@ +2003-12-13 Charles Zhang <charles zhang sun com> + + *e-msg-composer.c (message_rfc822_dnd): set CamelMimePart filename. + Fixes bug 47545. + Index: composer/e-msg-composer.c =================================================================== RCS file: /cvs/gnome/evolution/composer/e-msg-composer.c,v retrieving revision 1.395.2.8 diff -u -p -r1.395.2.8 e-msg-composer.c --- composer/e-msg-composer.c 6 Oct 2003 17:07:16 -0000 1.395.2.8 +++ composer/e-msg-composer.c 22 Dec 2003 11:47:56 -0000 @@ -2540,23 +2540,34 @@ message_rfc822_dnd (EMsgComposer *compos while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) { CamelMimeMessage *message; CamelMimePart *part; + const char *subject; + char *desc; message = camel_mime_message_new (); if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (message), mp) == -1) { camel_object_unref (message); break; } - + + 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_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (message)); + camel_mime_part_set_description (part, desc); camel_mime_part_set_content_type (part, "message/rfc822"); + g_free (desc); + e_msg_composer_attachment_bar_attach_mime_part (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), part); camel_object_unref (message); camel_object_unref (part); - + /* skip over the FROM_END state */ camel_mime_parser_step (mp, 0, 0); }