Changeset 3722

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

Backported from trunk.
* 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
  • releases/modest/diablo-pe2/ChangeLog

    r3719 r3722  
     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-04  Jose Dapena Paz  <jdapena@igalia.com> 
    214 
  • releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-folder.c

    r3716 r3722  
    180180static void stop_gmsgstore_from_idle (CamelImapFolder *imap_folder); 
    181181 
     182static const gchar *imap_search_request_string (CamelImapFolder *imap_folder); 
     183 
    182184#ifdef G_OS_WIN32 
    183185/* The strtok() in Microsoft's C library is MT-safe (but still uses 
     
    31683170 
    31693171static guint32 
    3170 imap_get_uids (CamelFolder *folder, CamelImapStore *store, CamelException *ex, GPtrArray *needheaders, int size) 
     3172imap_get_uids (CamelFolder *folder, CamelImapStore *store, CamelException *ex, GPtrArray *needheaders, int greater_than, int size) 
    31713173{ 
    31723174        char *resp = NULL; 
     
    31943196                } else { 
    31953197                        GData *data = parse_fetch_response ((CamelImapFolder *)folder, resp); 
     3198                        int sequence = GPOINTER_TO_INT (g_datalist_get_data (&data, "SEQUENCE")); 
    31963199                        char *uid = g_datalist_get_data (&data, "UID"); 
    3197                         if (uid) { 
     3200                        if (sequence > greater_than && uid) { 
    31983201                                g_ptr_array_add (needheaders, g_strdup (uid)); 
    31993202                                cnt++; 
     
    32203223 
    32213224} 
     3225 
     3226static const gchar * 
     3227imap_search_request_string (CamelImapFolder *imap_folder) 
     3228{ 
     3229        CamelImapStore *store = CAMEL_IMAP_STORE (CAMEL_FOLDER (imap_folder)->parent_store); 
     3230 
     3231        if (store->capabilities & IMAP_CAPABILITY_XAOLNETMAIL) { 
     3232                return "UID FETCH %d:* (UID)"; 
     3233        } else { 
     3234                return "UID SEARCH %d:* ALL"; 
     3235        } 
     3236} 
     3237 
    32223238 
    32233239static void 
     
    32823298 
    32833299        if (!camel_imap_command_start (store, folder, ex, 
    3284                 "UID SEARCH %d:%d ALL", seq + 1, MAX (1, MIN (seq + 1 + nextn, exists)))) 
     3300                                       imap_search_request_string ((CamelImapFolder *) folder),  
     3301                                       seq + 1, MAX (1, MIN (seq + 1 + nextn, exists)))) 
    32853302                { 
    32863303                        if (camel_operation_cancel_check (NULL)) 
     
    32943311        more = FALSE; 
    32953312        needheaders = g_ptr_array_new (); 
    3296         cnt = imap_get_uids (folder, store, ex, needheaders, (exists - seq)); 
     3313        cnt = imap_get_uids (folder, store, ex, needheaders, seq, (exists - seq)); 
    32973314 
    32983315        if (cnt == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) 
     
    33203337        { 
    33213338                if (!camel_imap_command_start (store, folder, ex, 
    3322                         "UID SEARCH %d:* ALL", seq + 1 + cnt)) 
     3339                                              imap_search_request_string ((CamelImapFolder *) folder), seq + 1 + cnt)) 
    33233340                        { 
    33243341                                if (camel_operation_cancel_check (NULL)) 
     
    33303347                                return; 
    33313348                        } 
    3332                 cnt = imap_get_uids (folder, store, ex, needheaders, (exists - seq) - cnt); 
     3349                cnt = imap_get_uids (folder, store, ex, needheaders, seq + cnt , (exists - seq) - cnt); 
    33333350 
    33343351                if (cnt == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) 
     
    33723389                        camel_folder_summary_dispose_all (folder->summary); 
    33733390 
    3374                         tcnt = cnt = imap_get_uids (folder, store, ex, needheaders, (exists - seq) - tcnt); 
     3391                        tcnt = cnt = imap_get_uids (folder, store, ex, needheaders, seq + tcnt, (exists - seq) - tcnt); 
    33753392 
    33763393                        if (cnt == 0 && camel_exception_get_id (ex) == CAMEL_EXCEPTION_USER_CANCEL) 
     
    34843501                                  if (sequence > 0 && sequence <= exists && sequence != curlen) 
    34853502                                  { 
    3486                                       int r; 
    3487                                       if (curlen > sequence) 
    3488                                       { 
    3489                                               for (r = curlen-1; r >= sequence -1; r--) 
    3490                                               { 
    3491                                                       CamelMessageInfo *ri; 
    3492                                                       g_warning ("Problem with your local summary store (too much), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
    3493                                                       ri = g_ptr_array_index (folder->summary->messages, r); 
    3494                                                       if (ri) { 
    3495                                                               /* camel_folder_change_info_remove_uid (mchange, camel_message_info_uid (mi)); */ 
    3496                                                               ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_EXPUNGED; 
    3497                                                               ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_FREED; 
    3498                                                               camel_folder_summary_remove (folder->summary, ri); 
    3499                                                       } 
    3500                                               } 
    3501                                       } else { 
    3502                                               for (r=0; r < sequence - curlen - 1; r++) 
    3503                                               { 
    3504                                                       CamelMessageInfo *ni = camel_message_info_clone (mi); 
    3505                                                       if (ni) { 
    3506                                                               g_warning ("Problem with your local summary store (too few), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
    3507                                                               camel_folder_summary_add (folder->summary, (CamelMessageInfo *)ni); 
    3508                                                               /* camel_folder_change_info_add_uid (mchanges, camel_message_info_uid (ni)); */ 
    3509                                                       } 
    3510                                               } 
    3511                                       } 
    3512                                       oosync = TRUE; 
     3503                                      int r; 
     3504                                      if (curlen > sequence) 
     3505                                      { 
     3506                                              for (r = curlen-1; r >= sequence -1; r--) 
     3507                                              { 
     3508                                                      CamelMessageInfo *ri; 
     3509                                                      g_warning ("Problem with your local summary store (too much), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
     3510                                                      ri = g_ptr_array_index (folder->summary->messages, r); 
     3511                                                      if (ri) { 
     3512                                                              /* camel_folder_change_info_remove_uid (mchange, camel_message_info_uid (mi)); */ 
     3513                                                              ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_EXPUNGED; 
     3514                                                              ((CamelMessageInfoBase*)ri)->flags |= CAMEL_MESSAGE_FREED; 
     3515                                                              camel_folder_summary_remove (folder->summary, ri); 
     3516                                                      } 
     3517                                              } 
     3518                                      } else { 
     3519                                              for (r=0; r < sequence - curlen - 1; r++) 
     3520                                              { 
     3521                                                      CamelMessageInfo *ni = camel_message_info_clone (mi); 
     3522                                                      if (ni) { 
     3523                                                              g_warning ("Problem with your local summary store (too few), correcting: curlen=%d, r=%d, seq=%d\n", curlen, r, sequence); 
     3524                                                              camel_folder_summary_add (folder->summary, (CamelMessageInfo *)ni); 
     3525                                                              /* camel_folder_change_info_add_uid (mchanges, camel_message_info_uid (ni)); */ 
     3526                                                      } 
     3527                                              } 
     3528                                      } 
     3529                                      oosync = TRUE; 
    35133530                                  } 
    35143531 
  • releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.c

    r3710 r3722  
    774774        { "LIST-EXTENDED",      IMAP_CAPABILITY_LISTEXT }, 
    775775        { "COMPRESS=DEFLATE",   IMAP_CAPABILITY_COMPRESS }, 
     776        { "XAOL-NETMAIL",       IMAP_CAPABILITY_XAOLNETMAIL }, 
    776777        { NULL, 0 } 
    777778}; 
  • releases/modest/diablo-pe2/libtinymail-camel/camel-lite/camel/providers/imap/camel-imap-store.h

    r3565 r3722  
    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)