Changeset 3713

Show
Ignore:
Timestamp:
07/01/08 17:42:42
Author:
jdapena
Message:

* libtinymail-camel/camel-lite/camel/camel-mime-utils.c:

        • Parse properly broken rfc2047 recipient headers sent from

gmail imap.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3712 r3713  
    2121        * libtinymail-camel/tny-camel-pop-store-account.c: 
    2222        Manage properly the internal inbox reference to avoid leaking it. 
     23 
     24        * libtinymail-camel/camel-lite/camel/camel-mime-utils.c: 
     25        Parse properly broken rfc2047 recipient headers sent from gmail imap. 
    2326 
    24272008-06-26  Philip Van Hoof <pvanhoof@gnome.org> 
  • trunk/libtinymail-camel/camel-lite/camel/camel-mime-utils.c

    r3538 r3713  
    24632463   */ 
    24642464 
     2465static void 
     2466fix_broken_rfc2047 (const char **in) 
     2467{ 
     2468        gchar *p, *broken_start, *r; 
     2469        gboolean encoded = FALSE; 
     2470        gboolean broken = TRUE; 
     2471 
     2472        p = *in; 
     2473 
     2474        while (*p != '\0') { 
     2475                if (!encoded) { 
     2476                        if (*p == '=' && *(p+1) == '?') { 
     2477                                p++; 
     2478                                encoded = TRUE; 
     2479                                broken = FALSE; 
     2480                        } 
     2481                } else if (!broken) { 
     2482                        if (*p == '<') { 
     2483                                broken = TRUE; 
     2484                                broken_start = p; 
     2485                        } else if ((*p == '?') && (*(p+1) == '=')) { 
     2486                                encoded = FALSE; 
     2487                                p++; 
     2488                        } 
     2489                } else { 
     2490                        if ((*p == '?') && (*(p+1) == '=')) { 
     2491                                memmove (broken_start + 2, broken_start, p - broken_start); 
     2492                                broken_start[0] = '?'; 
     2493                                broken_start[1] = '='; 
     2494                                broken = FALSE; 
     2495                                encoded = FALSE; 
     2496                        } 
     2497                } 
     2498                p++; 
     2499        } 
     2500 
     2501} 
     2502 
    24652503static struct _camel_header_address * 
    24662504header_decode_mailbox(const char **in, const char *charset) 
     
    24752513 
    24762514        addr = g_string_new(""); 
     2515 
     2516        if (strncmp (inptr, "=?", 2)==0) { 
     2517                /* check if we've got a wrong string as gmail sends and fix it.*/ 
     2518                fix_broken_rfc2047 (in); 
     2519        } 
    24772520 
    24782521        /* for each address */