Changeset 3721

Show
Ignore:
Timestamp:
07/16/08 15:39:39
Author:
jdapena
Message:

* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.[ch]:

        • Added fetching aol specific imap capability.

* libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.[ch]:

        • Now we use FETCH instead of SEARCH for getting the UID's
          when the server is AOL.
        • Added an extra check in imap_get_uids. If server gives a list
          including sequence numbers we didn't request, we ignore them.
          This should fix the AOL problem fetching headers.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3720 r3721  
     12008-07-16  Jose Dapena Paz  <jdapena@igalia.com> 
     2 
     3        * libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.[ch]: 
     4        Added fetching aol specific imap capability. 
     5 
     6        * libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.[ch]: 
     7        Now we use FETCH instead of SEARCH for getting the UID's 
     8        when the server is AOL. 
     9        Added an extra check in imap_get_uids. If server gives a list 
     10        including sequence numbers we didn't request, we ignore them. 
     11        This should fix the AOL problem fetching headers. 
     12 
    1132008-07-16  Sergio Villar Senin  <svillar@igalia.com> 
    214 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c

    r3715 r3721  
    182182static void stop_gmsgstore_from_idle (CamelImapFolder *imap_folder); 
    183183 
     184static const gchar *imap_search_request_string (CamelImapFolder *imap_folder); 
     185 
    184186#ifdef G_OS_WIN32 
    185187/* The strtok() in Microsoft's C library is MT-safe (but still uses 
     
    31903192 
    31913193static guint32 
    3192 imap_get_uids (CamelFolder *folder, CamelImapStore *store, CamelException *ex, GPtrArray *needheaders, int size) 
     3194imap_get_uids (CamelFolder *folder, CamelImapStore *store, CamelException *ex, GPtrArray *needheaders, int greater_than, int size) 
    31933195{ 
    31943196        char *resp = NULL; 
     
    32163218                } else { 
    32173219                        GData *data = parse_fetch_response ((CamelImapFolder *)folder, resp); 
     3220                        int sequence = GPOINTER_TO_INT (g_datalist_get_data (&data, "SEQUENCE")); 
    32183221                        char *uid = g_datalist_get_data (&data, "UID"); 
    3219                         if (uid) { 
     3222                        if (sequence > greater_than && uid) { 
    32203223                                g_ptr_array_add (needheaders, g_strdup (uid)); 
    32213224                                cnt++; 
     
    32423245 
    32433246} 
     3247 
     3248static const gchar * 
     3249imap_search_request_string (CamelImapFolder *imap_folder) 
     3250{ 
     3251        CamelImapStore *store = CAMEL_IMAP_STORE (CAMEL_FOLDER (imap_folder)->parent_store); 
     3252 
     3253        if (store->capabilities & IMAP_CAPABILITY_XAOLNETMAIL) { 
     3254                return "UID FETCH %d:* (UID)"; 
     3255        } else { 
     3256                return "UID SEARCH %d:* ALL"; 
     3257        } 
     3258} 
     3259 
    32443260 
    32453261static void 
     
    33043320 
    33053321        if (!camel_imap_command_start (store, folder, ex, 
    3306                 "UID SEARCH %d:%d ALL", seq + 1, MAX (1, MIN (seq + 1 + nextn, exists)))) 
     3322                                       imap_search_request_string ((CamelImapFolder *) folder),  
     3323                                       seq + 1, MAX (1, MIN (seq + 1 + nextn, exists)))) 
    33073324                { 
    33083325                        if (camel_operation_cancel_check (NULL)) 
     
    33163333        more = FALSE; 
    33173334        needheaders = g_ptr_array_new (); 
    3318         cnt = imap_get_uids (folder, store, ex, needheaders, (exists - seq)); 
     3335        cnt = imap_get_uids (folder, store, ex, needheaders, seq, (exists - seq)); 
    33193336 
    33203337        if (cnt == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) 
     
    33613378                } 
    33623379 
    3363                 tcnt = cnt = imap_get_uids (folder, store, ex, needheaders, (exists - seq) - tcnt); 
     3380                tcnt = cnt = imap_get_uids (folder, store, ex, needheaders, seq + tcnt, (exists - seq) - tcnt); 
    33643381 
    33653382                if (cnt == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) 
     
    33893406        { 
    33903407                if (!camel_imap_command_start (store, folder, ex, 
    3391                         "UID SEARCH %d:* ALL", seq + 1 + cnt)) 
     3408                                              imap_search_request_string ((CamelImapFolder *) folder), seq + 1 + cnt)) 
    33923409                        { 
    33933410                                if (camel_operation_cancel_check (NULL)) 
     
    34023419                camel_folder_summary_dispose_all (folder->summary); 
    34033420 
    3404                 cnt = imap_get_uids (folder, store, ex, needheaders, (exists - seq) - cnt); 
     3421                cnt = imap_get_uids (folder, store, ex, needheaders, seq + cnt, (exists - seq) - cnt); 
    34053422 
    34063423                if (cnt == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) 
     
    34443461                        camel_folder_summary_dispose_all (folder->summary); 
    34453462 
    3446                         tcnt = cnt = imap_get_uids (folder, store, ex, needheaders, (exists - seq) - tcnt); 
     3463                        tcnt = cnt = imap_get_uids (folder, store, ex, needheaders, seq + tcnt, (exists - seq) - tcnt); 
    34473464 
    34483465                        if (cnt == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) 
     
    35563573                                  if (sequence > 0 && sequence <= exists && sequence != curlen) 
    35573574                                  { 
    3558                                       int r; 
    3559                                       if (curlen > sequence) 
    3560                                       { 
    3561                                               for (r = curlen-1; r >= sequence -1; r--) 
    3562                                               { 
    3563                                                       CamelMessageInfo *ri; 
    3564                                                       g_warning ("Problem with your local summary store (too much), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
    3565                                                       ri = g_ptr_array_index (folder->summary->messages, r); 
    3566                                                       if (ri) { 
    3567                                                               /* camel_folder_change_info_remove_uid (mchange, camel_message_info_uid (mi)); */ 
    3568                                                               ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_EXPUNGED; 
    3569                                                               ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_FREED; 
    3570                                                               camel_folder_summary_remove (folder->summary, ri); 
    3571                                                       } 
    3572                                               } 
    3573                                       } else { 
    3574                                               for (r=0; r < sequence - curlen - 1; r++) 
    3575                                               { 
    3576                                                       CamelMessageInfo *ni = camel_message_info_clone (mi); 
    3577                                                       if (ni) { 
    3578                                                               g_warning ("Problem with your local summary store (too few), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
    3579                                                               camel_folder_summary_add (folder->summary, (CamelMessageInfo *)ni); 
    3580                                                               /* camel_folder_change_info_add_uid (mchanges, camel_message_info_uid (ni)); */ 
    3581                                                       } 
    3582                                               } 
    3583                                       } 
    3584                                       oosync = TRUE; 
     3575                                      int r; 
     3576                                      if (curlen > sequence) 
     3577                                      { 
     3578                                              for (r = curlen-1; r >= sequence -1; r--) 
     3579                                              { 
     3580                                                      CamelMessageInfo *ri; 
     3581                                                      g_warning ("Problem with your local summary store (too much), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
     3582                                                      ri = g_ptr_array_index (folder->summary->messages, r); 
     3583                                                      if (ri) { 
     3584                                                              /* camel_folder_change_info_remove_uid (mchange, camel_message_info_uid (mi)); */ 
     3585                                                              ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_EXPUNGED; 
     3586                                                              ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_FREED; 
     3587                                                              camel_folder_summary_remove (folder->summary, ri); 
     3588                                                      } 
     3589                                              } 
     3590                                      } else { 
     3591                                              for (r=0; r < sequence - curlen - 1; r++) 
     3592                                              { 
     3593                                                      CamelMessageInfo *ni = camel_message_info_clone (mi); 
     3594                                                      if (ni) { 
     3595                                                              g_warning ("Problem with your local summary store (too few), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
     3596                                                              camel_folder_summary_add (folder->summary, (CamelMessageInfo *)ni); 
     3597                                                              /* camel_folder_change_info_add_uid (mchanges, camel_message_info_uid (ni)); */ 
     3598                                                      } 
     3599                                              } 
     3600                                      } 
     3601                                      oosync = TRUE; 
    35853602                                  } 
    35863603 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r3708 r3721  
    774774        { "LIST-EXTENDED",      IMAP_CAPABILITY_LISTEXT }, 
    775775        { "COMPRESS=DEFLATE",   IMAP_CAPABILITY_COMPRESS }, 
     776        { "XAOL-NETMAIL",       IMAP_CAPABILITY_XAOLNETMAIL }, 
    776777        { NULL, 0 } 
    777778}; 
  • trunk/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.h

    r3565 r3721  
    126126#define IMAP_CAPABILITY_LISTEXT                 (1 << 19) 
    127127#define IMAP_CAPABILITY_COMPRESS                (1 << 20) 
     128#define IMAP_CAPABILITY_XAOLNETMAIL             (1 << 21) 
    128129 
    129130#define IMAP_PARAM_OVERRIDE_NAMESPACE           (1 << 0)