Changeset 3018

Show
Ignore:
Timestamp:
11/28/07 13:40:27
Author:
pvanhoof
Message:

Parser fix

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/pvanhoof/bs/libtinymail-camel/bs/bodystruct.c

    r3016 r3018  
    295295} 
    296296 
     297#if DEBUG 
    297298static void  
    298299print_params (struct _mimeparam *param) 
     
    307308        } 
    308309} 
     310#else 
     311#define print_params(o)           
     312#endif 
    309313 
    310314static struct _mimeparam * 
     
    733737                part->next = NULL; 
    734738                part->content.type = decode_qstring (&inptr, inend, err); 
     739                if (!part->content.type) 
     740                        part->content.type = g_strdup ("TEXT"); 
     741 
    735742                debug_printf ("contentype: %s\n", part->content.type); 
    736743                part->content.subtype = decode_qstring (&inptr, inend, err); 
     744                if (!part->content.subtype) 
     745                        part->content.subtype = g_strdup ("PLAIN"); 
    737746                debug_printf ("contensubtype: %s\n", part->content.subtype); 
    738747 
     
    746755                if (!strcasecmp (part->content.type, "message") && !strcasecmp (part->content.subtype, "rfc822")) { 
    747756 
    748                         part->content.params = decode_params (&inptr, inend, err); 
    749                         print_params (part->content.params); 
    750  
    751                         part->content.cid = decode_qstring (&inptr, inend, err); 
    752                         debug_printf ("content.cid: %s\n", part->content.cid); 
    753  
    754                         part->description = decode_qstring (&inptr, inend, err); 
    755                         debug_printf ("description: %s\n", part->description); 
    756  
    757                         part->encoding = decode_qstring (&inptr, inend, err); 
    758                         debug_printf ("encoding: %s\n", part->encoding); 
    759                         part->octets = decode_num (&inptr, inend, err); 
    760                         debug_printf ("octets: %d\n", part->octets); 
    761  
    762                         part->envelope = decode_envelope (&inptr, inend, err); 
    763                         part->subparts = bodystruct_part_decode (&inptr, inend, part, 1, err); 
    764  
    765                         part->lines = decode_num (&inptr, inend, err); 
    766                         debug_printf ("lines: %d\n", part->lines); 
    767  
    768                         read_unknown_qstring (&inptr, inend, err); 
    769  
    770                         parse_content_disposition (&inptr, inend, &part->disposition, err); 
    771  
    772                         parse_lang (&inptr, inend, part, err); 
     757                        if (*inptr != ')') { 
     758                                part->content.params = decode_params (&inptr, inend, err); 
     759                                print_params (part->content.params); 
     760                        } 
     761 
     762                        if (*inptr != ')') { 
     763                                part->content.cid = decode_qstring (&inptr, inend, err); 
     764                                debug_printf ("content.cid: %s\n", part->content.cid); 
     765                        } 
     766 
     767                        if (*inptr != ')') { 
     768                                part->description = decode_qstring (&inptr, inend, err); 
     769                                debug_printf ("description: %s\n", part->description); 
     770                        } 
     771 
     772                        if (*inptr != ')') { 
     773                                part->encoding = decode_qstring (&inptr, inend, err); 
     774                                debug_printf ("encoding: %s\n", part->encoding); 
     775                        } 
     776 
     777                        if (*inptr != ')') { 
     778                                part->octets = decode_num (&inptr, inend, err); 
     779                                debug_printf ("octets: %d\n", part->octets); 
     780                        } 
     781 
     782                        if (*inptr != ')') { 
     783                                part->envelope = decode_envelope (&inptr, inend, err); 
     784                                part->subparts = bodystruct_part_decode (&inptr, inend, part, 1, err); 
     785                        } 
     786 
     787                        if (*inptr != ')') { 
     788                                part->lines = decode_num (&inptr, inend, err); 
     789                                debug_printf ("lines: %d\n", part->lines); 
     790                        } 
     791 
     792                        if (*inptr != ')') { 
     793                                read_unknown_qstring (&inptr, inend, err); 
     794                        } 
     795 
     796                        if (*inptr != ')') { 
     797                                parse_content_disposition (&inptr, inend, &part->disposition, err); 
     798                        } 
     799 
     800                        if (*inptr != ')') { 
     801                                parse_lang (&inptr, inend, part, err); 
     802                        } 
    773803 
    774804                } else if (!strcasecmp (part->content.type, "text")) { 
    775805 
    776                         part->content.params = decode_params (&inptr, inend, err); 
    777                         print_params (part->content.params); 
    778  
    779                         part->content.cid = decode_qstring (&inptr, inend, err); 
    780                         debug_printf ("content.cid: %s\n", part->content.cid); 
    781  
    782                         read_unknown_qstring (&inptr, inend, err); 
    783  
    784                         part->encoding = decode_qstring (&inptr, inend, err); 
    785                         debug_printf ("encoding: %s\n", part->encoding); 
    786  
    787                         part->octets = decode_num (&inptr, inend, err); 
    788                         debug_printf ("octets: %d\n", part->octets); 
    789  
    790                         part->lines = decode_num (&inptr, inend, err); 
    791                         debug_printf ("lines: %d\n", part->lines); 
    792  
    793                         /* Google's IMAP server stops here  ... */ 
    794                         if (*inptr != ')')  
    795                         { 
     806                        if (*inptr != ')') { 
     807                                part->content.params = decode_params (&inptr, inend, err); 
     808                                print_params (part->content.params); 
     809                        } 
     810 
     811                        if (*inptr != ')') { 
     812                                part->content.cid = decode_qstring (&inptr, inend, err); 
     813                                debug_printf ("content.cid: %s\n", part->content.cid); 
     814                        } 
     815 
     816                        if (*inptr != ')') { 
    796817                                read_unknown_qstring (&inptr, inend, err); 
     818                        } 
     819 
     820                        if (*inptr != ')') { 
     821                                part->encoding = decode_qstring (&inptr, inend, err); 
     822                                debug_printf ("encoding: %s\n", part->encoding); 
     823                        } 
     824 
     825                        if (*inptr != ')') { 
     826                                part->octets = decode_num (&inptr, inend, err); 
     827                                debug_printf ("octets: %d\n", part->octets); 
     828                        } 
     829 
     830                        if (*inptr != ')') { 
     831                                part->lines = decode_num (&inptr, inend, err); 
     832                                debug_printf ("lines: %d\n", part->lines); 
     833                        } 
     834 
     835                        if (*inptr != ')') { 
     836                                read_unknown_qstring (&inptr, inend, err); 
     837                        } 
     838 
     839                        if (*inptr != ')') { 
    797840                                parse_content_disposition (&inptr, inend, &part->disposition, err); 
     841                        } 
     842 
     843                        if (*inptr != ')') { 
    798844                                parse_lang (&inptr, inend, part, err); 
    799845                        } 
     
    803849                                !strcasecmp (part->content.type, "audio")) 
    804850                { 
    805                         part->content.params = decode_params (&inptr, inend, err); 
    806                         print_params (part->content.params); 
    807  
    808                         part->content.cid = decode_qstring (&inptr, inend, err); 
    809                         debug_printf ("content.cid: %s\n", part->content.cid); 
    810  
    811                         read_unknown_qstring (&inptr, inend, err); 
    812  
    813                         part->encoding = decode_qstring (&inptr, inend, err); 
    814                         debug_printf ("encoding: %s\n", part->encoding); 
    815  
    816                         part->octets = decode_num (&inptr, inend, err); 
    817                         debug_printf ("octets: %d\n", part->octets); 
    818  
    819                         read_unknown_qstring (&inptr, inend, err); 
    820  
    821                         parse_content_disposition (&inptr, inend, &part->disposition, err); 
    822                         parse_lang (&inptr, inend, part, err); 
     851 
     852                        if (*inptr != ')') { 
     853                                part->content.params = decode_params (&inptr, inend, err); 
     854                                print_params (part->content.params); 
     855                        } 
     856 
     857                        if (*inptr != ')') { 
     858                                part->content.cid = decode_qstring (&inptr, inend, err); 
     859                                debug_printf ("content.cid: %s\n", part->content.cid); 
     860                        } 
     861 
     862                        if (*inptr != ')') { 
     863                                read_unknown_qstring (&inptr, inend, err); 
     864                        } 
     865 
     866                        if (*inptr != ')') { 
     867                                part->encoding = decode_qstring (&inptr, inend, err); 
     868                                debug_printf ("encoding: %s\n", part->encoding); 
     869                        } 
     870 
     871                        if (*inptr != ')') { 
     872                                part->octets = decode_num (&inptr, inend, err); 
     873                                debug_printf ("octets: %d\n", part->octets); 
     874                        } 
     875 
     876                        if (*inptr != ')') { 
     877                                read_unknown_qstring (&inptr, inend, err); 
     878                        } 
     879 
     880                        if (*inptr != ')') { 
     881                                parse_content_disposition (&inptr, inend, &part->disposition, err); 
     882                        } 
     883 
     884                        if (*inptr != ')') { 
     885                                parse_lang (&inptr, inend, part, err); 
     886                        } 
     887 
    823888                } else { 
    824889                        /* I don't know how it looks, so I just read it away */