Changeset 3457

Show
Ignore:
Timestamp:
03/04/08 15:17:30
Author:
jdapena
Message:

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

Now, when we get the parts of a mime part that's a message,
we check if any part has an attachment content disposition,
and update the attachments flag properly.
* Moved bodystructure parser to camel, so that we
can use it there.
* libtinymail-camel/camel-lite/bs/bodystruct.c:
Added missing if, to avoid fetching the header badly (and
causing coredumps) for bodystructure strings not
including BODYSTRUCTURE prefix.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3455 r3457  
     12008-03-04  Jose Dapena Paz  <jdapena@igalia.com> 
     2 
     3        * libtinymail-camel/tny-camel-mime-part.c: 
     4        Now, when we get the parts of a mime part that's a message, 
     5        we check if any part has an attachment content disposition, 
     6        and update the attachments flag properly. 
     7        * Moved bodystructure parser to camel, so that we 
     8        can use it there. 
     9        * libtinymail-camel/camel-lite/bs/bodystruct.c: 
     10        Added missing if, to avoid fetching the header badly (and 
     11        causing coredumps) for bodystructure strings not 
     12        including BODYSTRUCTURE prefix. 
     13 
    1142008-03-04  Philip Van Hoof <pvanhoof@gnome.org> 
    215 
  • trunk/libtinymail-camel/Makefile.am

    r3442 r3457  
    1 SUBDIRS = camel-lite bs
     1SUBDIRS = camel-lite
    22 
    33INCLUDES = $(LIBTINYMAIL_CAMEL_CFLAGS)          \ 
     
    102102        $(LIBTINYMAIL_CAMEL_LIBS) \ 
    103103        $(top_builddir)/libtinymail-camel/camel-lite/camel/libcamel-lite-1.2.la \ 
    104         $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la \ 
    105         $(top_builddir)/libtinymail-camel/bs/libbodystruct.la  
     104        $(top_builddir)/libtinymail/libtinymail-$(API_VERSION).la 
    106105 
    107106libtinymail_camel_1_0_la_LDFLAGS = -export-dynamic -version-info \ 
  • trunk/libtinymail-camel/camel-lite/Makefile.am

    r3232 r3457  
    1 SUBDIRS = summary libedataserver camel 
     1SUBDIRS = bs summary libedataserver camel 
    22 
    33EXTRA_DIST = iconv-detect.h 
  • trunk/libtinymail-camel/camel-lite/bs/Makefile.am

    r3456 r3457  
    1 INCLUDES = $(LIBTINYMAIL_CAMEL_CFLAGS)          \ 
    2         -I. -I$(top_srcdir)                     \ 
    3         -I$(top_srcdir)/libtinymail             \ 
    4         -I$(top_srcdir)/libtinymail-camel/camel-lite 
     1INCLUDES = -I. \ 
     2        $(CAMEL_CFLAGS) 
     3         
    54 
    65noinst_LTLIBRARIES = libbodystruct.la 
  • trunk/libtinymail-camel/camel-lite/bs/bodystruct.c

    r3456 r3457  
    11171117        bodystruct_t *r = NULL; 
    11181118 
    1119         if (!start) 
     1119        if (!start) { 
    11201120                r = bodystruct_part_decode (&inbuf, inbuf + inlen, NULL, 1, err); 
    1121  
    1122         start += 13; 
    1123         lendif = (int) start - (int) inbuf; 
    1124  
    1125         r = bodystruct_part_decode (&start, (unsigned char *) ( start + (inlen - lendif) ), NULL, 1, err); 
     1121        } else { 
     1122 
     1123                start += 13; 
     1124                lendif = (int) start - (int) inbuf; 
     1125                 
     1126                r = bodystruct_part_decode (&start, (unsigned char *) ( start + (inlen - lendif) ), NULL, 1, err); 
     1127        } 
    11261128        if (!r->part_spec) 
    11271129                r->part_spec = g_strdup ("1"); 
  • trunk/libtinymail-camel/camel-lite/camel/Makefile.am

    r3443 r3457  
    289289        $(SOCKET_LIBS)                                                  \ 
    290290        $(REGEX_LIBS)                                                   \ 
    291         $(SSL_LIBS) 
     291        $(SSL_LIBS)                                                     \ 
     292        $(top_builddir)/bs/libbodystruct.la  
    292293 
    293294camel-mime-tables.c: gentables.pl 
  • trunk/libtinymail-camel/camel-lite/configure.ac

    r3232 r3457  
    222222AC_OUTPUT([ 
    223223Makefile 
     224bs/Makefile 
    224225camel/Makefile 
    225226camel/providers/Makefile 
  • trunk/libtinymail-camel/tny-camel-mime-part.c

    r3453 r3457  
    170170        gboolean is_related = FALSE; 
    171171        CamelContentType *content_type = NULL; 
     172        gboolean has_attachments = FALSE; 
    172173 
    173174        g_assert (TNY_IS_LIST (list)); 
     
    198199                        TnyMimePart *newpart=NULL; 
    199200                        CamelContentType *type; 
     201                        const gchar *disposition; 
    200202 
    201203                        if (!tpart || !CAMEL_IS_MIME_PART (tpart)) 
    202204                                continue; 
     205 
     206                        disposition = camel_mime_part_get_disposition (tpart); 
     207 
     208                        if (camel_strstrcase (disposition, "attachment") != NULL) 
     209                                has_attachments = TRUE; 
    203210 
    204211                        type = camel_mime_part_get_content_type (tpart); 
     
    242249                        tny_list_prepend (list, G_OBJECT (newpart)); 
    243250                        g_object_unref (G_OBJECT (newpart)); 
     251                } 
     252        } 
     253 
     254        if (TNY_IS_MSG (self)) { 
     255                TnyHeader *header; 
     256 
     257                header = tny_msg_get_header (TNY_MSG (self)); 
     258                if (header) { 
     259                        if (has_attachments &&  
     260                            !(tny_header_get_flags (header) & TNY_HEADER_FLAG_ATTACHMENTS)) 
     261                                tny_header_set_flag (header, TNY_HEADER_FLAG_ATTACHMENTS); 
     262                        g_object_unref (header); 
    244263                } 
    245264        }