diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-01-16 02:58:24 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-01-16 02:58:24 +0800 |
commit | 811c9c4acdc308b55d38dda2fda2e30433cd5e5b (patch) | |
tree | 58edb231149541ad77d8b100ff48652416130f82 /camel/providers/imap | |
parent | d636d53bc9af47f29681c6ec340745b511af4281 (diff) | |
download | gsoc2013-evolution-811c9c4acdc308b55d38dda2fda2e30433cd5e5b.tar gsoc2013-evolution-811c9c4acdc308b55d38dda2fda2e30433cd5e5b.tar.gz gsoc2013-evolution-811c9c4acdc308b55d38dda2fda2e30433cd5e5b.tar.bz2 gsoc2013-evolution-811c9c4acdc308b55d38dda2fda2e30433cd5e5b.tar.lz gsoc2013-evolution-811c9c4acdc308b55d38dda2fda2e30433cd5e5b.tar.xz gsoc2013-evolution-811c9c4acdc308b55d38dda2fda2e30433cd5e5b.tar.zst gsoc2013-evolution-811c9c4acdc308b55d38dda2fda2e30433cd5e5b.zip |
Sort the needheaders UID array and fixed to respect the UID_SET_LIMIT.
2002-01-15 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-folder.c (imap_update_summary): Sort
the needheaders UID array and fixed to respect the
UID_SET_LIMIT. This should now finish the fixification of bug
#2529. There's still the possible issue that a command-line (The
only command-line I can think of that can still be too long is a
SEARCH command, but this can't possibly be fixed until we rewrite
the imap code to use Zucchi's ImapEngine idea).
svn path=/trunk/; revision=15327
Diffstat (limited to 'camel/providers/imap')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 69 |
1 files changed, 41 insertions, 28 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 6da174fa00..e3888ec06f 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -746,9 +746,10 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException * int uid = 0; char *set; + CAMEL_IMAP_STORE_LOCK (store, command_lock); + while (uid < uids->len) { set = imap_uid_array_to_set (folder->summary, uids, uid, UID_SET_LIMIT, &uid); - CAMEL_IMAP_STORE_LOCK (store, command_lock); response = camel_imap_command (store, folder, ex, "UID STORE %s +FLAGS.SILENT \\Deleted", set); @@ -765,10 +766,12 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException * "UID EXPUNGE %s", set); } else response = camel_imap_command (store, folder, ex, "EXPUNGE"); + if (response) camel_imap_response_free (store, response); - CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } + + CAMEL_IMAP_STORE_UNLOCK (store, command_lock); } static int @@ -1852,38 +1855,48 @@ imap_update_summary (CamelFolder *folder, int exists, char *uidset; int uid = 0; - /* FIXME: sort needheaders */ - /* FIXME: modify code to allow for uidset limit */ - uidset = imap_uid_array_to_set (folder->summary, needheaders, uid, -1, &uid); - g_ptr_array_free (needheaders, TRUE); - if (!camel_imap_command_start (store, folder, ex, - "UID FETCH %s BODY.PEEK[%s]", - uidset, header_spec)) { - g_free (uidset); - goto lose; - } - g_free (uidset); + qsort (needheaders->pdata, needheaders->len, + sizeof (void *), uid_compar); camel_operation_start (NULL, _("Fetching summary information for new messages")); - while ((type = camel_imap_command_response (store, &resp, ex)) - == CAMEL_IMAP_RESPONSE_UNTAGGED) { - data = parse_fetch_response (imap_folder, resp); - g_free (resp); - if (!data) - continue; + + while (uid < needheaders->len) { + uidset = imap_uid_array_to_set (folder->summary, needheaders, uid, UID_SET_LIMIT, &uid); + if (!camel_imap_command_start (store, folder, ex, + "UID FETCH %s BODY.PEEK[%s]", + uidset, header_spec)) { + g_ptr_array_free (needheaders, TRUE); + camel_operation_end (NULL); + g_free (uidset); + goto lose; + } + g_free (uidset); - stream = g_datalist_get_data (&data, "BODY_PART_STREAM"); - if (stream) { - add_message_from_data (folder, messages, first, data); - got += IMAP_PRETEND_SIZEOF_HEADERS; - camel_operation_progress (NULL, got * 100 / size); + while ((type = camel_imap_command_response (store, &resp, ex)) + == CAMEL_IMAP_RESPONSE_UNTAGGED) { + data = parse_fetch_response (imap_folder, resp); + g_free (resp); + if (!data) + continue; + + stream = g_datalist_get_data (&data, "BODY_PART_STREAM"); + if (stream) { + add_message_from_data (folder, messages, first, data); + got += IMAP_PRETEND_SIZEOF_HEADERS; + camel_operation_progress (NULL, got * 100 / size); + } + g_datalist_clear (&data); + } + + if (type == CAMEL_IMAP_RESPONSE_ERROR) { + g_ptr_array_free (needheaders, TRUE); + camel_operation_end (NULL); + goto lose; } - g_datalist_clear (&data); } - camel_operation_end (NULL); - if (type == CAMEL_IMAP_RESPONSE_ERROR) - goto lose; + g_ptr_array_free (needheaders, TRUE); + camel_operation_end (NULL); } /* Now finish up summary entries (fix UIDs, set flags and size) */ |