[evolution-patches] fix for bug #42854, same but different



same fix as 42854, but for other entry points. A few of the functions I
added sorting to probably don't need it, but it doesn't hurt and it
ensures there aren't any issues that go unseen due to an unsorted list
of uids.

Jeff

-- 
Jeffrey Stedfast
Evolution Hacker - Ximian, Inc.
fejj ximian com  - www.ximian.com
? 42763.patch
? 42854-2.patch
? camel-charset-map.patch
? charset-map.c
? ct.patch
? imap.patch
? postfix.patch
? srep.sh
? subject-encoding.patch
? providers/mapi
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1820
diff -u -r1.1820 ChangeLog
--- ChangeLog	22 May 2003 20:17:01 -0000	1.1820
+++ ChangeLog	27 May 2003 04:56:39 -0000
@@ -1,3 +1,19 @@
+2003-05-27  Jeffrey Stedfast  <fejj ximian com>
+
+	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  <fejj ximian com>
 
 	* camel-object.c (camel_object_bag_destroy): Lets try this
Index: providers/imap/camel-imap-folder.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/providers/imap/camel-imap-folder.c,v
retrieving revision 1.301
diff -u -r1.301 camel-imap-folder.c
--- providers/imap/camel-imap-folder.c	14 May 2003 17:53:46 -0000	1.301
+++ providers/imap/camel-imap-folder.c	27 May 2003 04:56:40 -0000
@@ -823,12 +823,30 @@
 	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 @@
 	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 @@
 		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 @@
 	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 @@
 
 	/* 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;i<uids->len;i++) {
 		CamelMessageInfo *info;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]