From de9458db315d8857bfae6929b2585150c20a57cf Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Wed, 28 May 2003 00:42:19 +0000 Subject: This should finish fixing all variations of bug #42854, which, funnily 2003-05-27 Jeffrey Stedfast This should finish fixing all variations of bug #42854, which, funnily enough specified "copying" as the scenario for reproducing this bug, but somehow I found/fixed it only for expunging for some reason? I can't even guess as to how this happened. Oh well, expunging needed fixing either way. * providers/imap/camel-imap-folder.c (imap_transfer_online): Sort the uids here too (just like I had fixed for expunge a week or so ago). (imap_transfer_resyncing): Sort them here too. (imap_search_by_uids): Sort here too, even though I don't think it is necessary. Can't hurt. (imap_expunge_uids_offline): Might as well sort here too. svn path=/trunk/; revision=21341 --- camel/ChangeLog | 16 +++++++++++ camel/providers/imap/camel-imap-folder.c | 48 +++++++++++++++++++------------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index ced3b4e9e8..d3d92d2e39 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,19 @@ +2003-05-27 Jeffrey Stedfast + + This should finish fixing all variations of bug #42854, which, + funnily enough specified "copying" as the scenario for reproducing + this bug, but somehow I found/fixed it only for expunging for some + reason? I can't even guess as to how this happened. Oh well, + expunging needed fixing either way. + + * providers/imap/camel-imap-folder.c (imap_transfer_online): Sort + the uids here too (just like I had fixed for expunge a week or so + ago). + (imap_transfer_resyncing): Sort them here too. + (imap_search_by_uids): Sort here too, even though I don't think it + is necessary. Can't hurt. + (imap_expunge_uids_offline): Might as well sort here too. + 2003-05-22 Jeffrey Stedfast * camel-object.c (camel_object_bag_destroy): Lets try this diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 16638d3902..a3fbb9baf3 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -823,12 +823,30 @@ imap_sync_online (CamelFolder *folder, CamelException *ex) CAMEL_SERVICE_UNLOCK (store, connect_lock); } +static int +uid_compar (const void *va, const void *vb) +{ + const char **sa = (const char **)va, **sb = (const char **)vb; + unsigned long a, b; + + a = strtoul (*sa, NULL, 10); + b = strtoul (*sb, NULL, 10); + if (a < b) + return -1; + else if (a == b) + return 0; + else + return 1; +} + static void imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, CamelException *ex) { CamelFolderChangeInfo *changes; int i; - + + qsort (uids->pdata, uids->len, sizeof (void *), uid_compar); + changes = camel_folder_change_info_new (); for (i = 0; i < uids->len; i++) { @@ -847,22 +865,6 @@ imap_expunge_uids_offline (CamelFolder *folder, GPtrArray *uids, CamelException camel_folder_change_info_free (changes); } -static int -uid_compar (const void *va, const void *vb) -{ - const char **sa = (const char **)va, **sb = (const char **)vb; - unsigned long a, b; - - a = strtoul (*sa, NULL, 10); - b = strtoul (*sb, NULL, 10); - if (a < b) - return -1; - else if (a == b) - return 0; - else - return 1; -} - static void imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *ex) { @@ -1435,7 +1437,9 @@ imap_transfer_online (CamelFolder *source, GPtrArray *uids, return; count = camel_folder_summary_count (dest->summary); - + + qsort (uids->pdata, uids->len, sizeof (void *), uid_compar); + /* Now copy the messages */ do_copy (source, uids, dest, ex); if (camel_exception_is_set (ex)) @@ -1469,7 +1473,9 @@ imap_transfer_resyncing (CamelFolder *source, GPtrArray *uids, const char *uid; CamelMimeMessage *message; CamelMessageInfo *info; - + + qsort (uids->pdata, uids->len, sizeof (void *), uid_compar); + /* This is trickier than append_resyncing, because some of * the messages we are copying may have been copied or * appended into @source while we were offline, in which case @@ -1565,7 +1571,9 @@ imap_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids /* NOTE: could get away without the search lock by creating a new search object each time */ - + + qsort (uids->pdata, uids->len, sizeof (void *), uid_compar); + summary = g_ptr_array_new(); for (i=0;ilen;i++) { CamelMessageInfo *info; -- cgit v1.2.3