Changeset 2477

Show
Ignore:
Timestamp:
07/19/07 07:55:50
Author:
jdapena
Message:

* libtinymail/tny-camel-mime-part.c:

(tny_camel_mime_part_get_parts_default): improve detection
of attached messages, as we need to create a proper TnyMsg
object when the attachment is a message.
(tny_camel_mime_part_add_part_default): now when we are
attaching a message as a part, it's created adding a
message/rfc822 mime part that contains the message as
its content object. This fixes attaching messages.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/jdapena/guadec-week/ChangeLog

    r2476 r2477  
     12007-07-17  Jose Dapena Paz  <jdapena@igalia.com> 
     2 
     3        * libtinymail/tny-camel-mime-part.c: 
     4        (tny_camel_mime_part_get_parts_default): improve detection 
     5        of attached messages, as we need to create a proper TnyMsg 
     6        object when the attachment is a message. 
     7        (tny_camel_mime_part_add_part_default): now when we are 
     8        attaching a message as a part, it's created adding a  
     9        message/rfc822 mime part that contains the message as 
     10        its content object. This fixes attaching messages. 
     11 
    1122007-07-17  Jose Dapena Paz  <jdapena@igalia.com> 
    213 
  • devel/jdapena/guadec-week/libtinymail-camel/tny-camel-mime-part.c

    r2429 r2477  
    149149 
    150150                        type = camel_mime_part_get_content_type (tpart); 
    151                         if (camel_content_type_is (type, "message", "rfc822")) 
     151                        if (CAMEL_IS_MIME_MESSAGE (tpart)) 
     152                        { 
     153                                TnyHeader *nheader = _tny_camel_msg_header_new (CAMEL_MIME_MESSAGE (tpart), NULL); 
     154 
     155                                newpart = TNY_MIME_PART (tny_camel_msg_new ()); 
     156                                _tny_camel_msg_set_header (TNY_CAMEL_MSG (newpart), nheader); 
     157                                _tny_camel_mime_part_set_part (TNY_CAMEL_MIME_PART (newpart), CAMEL_MIME_PART (tpart)); 
     158                                g_object_unref (G_OBJECT (nheader)); 
     159                        } 
     160                        else if (camel_content_type_is (type, "message", "rfc822")) 
    152161                        { 
    153162                                CamelDataWrapper *c = camel_medium_get_content_object (CAMEL_MEDIUM (tpart)); 
    154                          
     163 
    155164                                if (c && CAMEL_IS_MIME_PART (c) && CAMEL_IS_MIME_MESSAGE (c))  
    156165                                { 
     
    235244 
    236245        cpart = tny_camel_mime_part_get_part (TNY_CAMEL_MIME_PART (part)); 
    237         camel_multipart_add_part (body, cpart); 
     246        if (CAMEL_IS_MIME_MESSAGE (cpart)) { 
     247                CamelMimePart *message_part = camel_mime_part_new (); 
     248                const gchar *subject; 
     249                gchar *description; 
     250 
     251                subject = camel_mime_message_get_subject (CAMEL_MIME_MESSAGE (cpart)); 
     252                if (subject) 
     253                        description = g_strdup (subject); 
     254                else 
     255                        description = _("Forwarded message"); 
     256 
     257                camel_mime_part_set_disposition (message_part, "inline"); 
     258                camel_medium_set_content_object (CAMEL_MEDIUM (message_part),  
     259                                                 CAMEL_DATA_WRAPPER (cpart)); 
     260                camel_mime_part_set_content_type (message_part, "message/rfc822"); 
     261                camel_multipart_add_part (body, message_part); 
     262                camel_object_unref (CAMEL_OBJECT (message_part)); 
     263        } else { 
     264                camel_multipart_add_part (body, cpart); 
     265        } 
    238266        camel_object_unref (CAMEL_OBJECT (cpart)); 
    239267