aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog14
-rw-r--r--camel/providers/imap/camel-imap-command.c3
-rw-r--r--camel/providers/imap/camel-imap-folder.c36
-rw-r--r--camel/providers/imap/camel-imap-utils.c2
4 files changed, 35 insertions, 20 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index d2f4dc8de1..a8d80e6f6c 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,17 @@
+2003-05-13 Jeffrey Stedfast <fejj@ximian.com>
+
+ * providers/imap/camel-imap-utils.c (imap_uid_array_to_set): Added
+ a note to the comment block for this function noting that uids
+ MUST be in sorted order.
+
+ * providers/imap/camel-imap-folder.c (imap_expunge_uids_online):
+ Sort the uids before splitting them into UID set chunks. The code
+ that splits the uid array into sets expects the uids to be in
+ sorted order. Fixes bug #42854.
+
+ * providers/imap/camel-imap-command.c (imap_command_start):
+ Re-enable camel_verbose_debug logging.
+
2003-05-12 Jeffrey Stedfast <fejj@ximian.com>
* providers/smtp/camel-smtp-transport.c (smtp_helo): If
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index bf04075ebc..5b6293bdb6 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -44,7 +44,6 @@
#include <camel/camel-utf8.h>
#include <camel/camel-session.h>
-#define d(x)
extern int camel_verbose_debug;
@@ -198,7 +197,6 @@ imap_command_start (CamelImapStore *store, CamelFolder *folder,
}
/* Send the command */
-#if d(!)0
if (camel_verbose_debug) {
const char *mask;
@@ -213,7 +211,6 @@ imap_command_start (CamelImapStore *store, CamelFolder *folder,
fprintf (stderr, "sending : %c%.5d %s\r\n", store->tag_prefix, store->command, mask);
}
-#endif
nwritten = camel_stream_printf (store->ostream, "%c%.5d %s\r\n",
store->tag_prefix, store->command++, cmd);
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 8a21c11451..16638d3902 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -847,6 +847,22 @@ 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)
{
@@ -864,7 +880,9 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
return;
}
}
-
+
+ qsort (uids->pdata, uids->len, sizeof (void *), uid_compar);
+
while (uid < uids->len) {
set = imap_uid_array_to_set (folder->summary, uids, uid, UID_SET_LIMIT, &uid);
response = camel_imap_command (store, folder, ex,
@@ -891,22 +909,6 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
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_resyncing (CamelFolder *folder, GPtrArray *uids, CamelException *ex)
{
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 65819475fb..61c27cb7a9 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -1079,6 +1079,8 @@ get_summary_uid_numeric (CamelFolderSummary *summary, int index)
*
* After calling, @lastuid will be set the index of the first uid
* *not* included in the returned set string.
+ *
+ * Note: @uids MUST be in sorted order for this code to work properly.
*
* Return value: the set, which the caller must free with g_free()
**/