aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-05-15 01:53:47 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-05-15 01:53:47 +0800
commit0297c01437237045337130d80cfd9da6f0a270de (patch)
treeb74ff852b254342be26849a59f82926a334fb213 /camel/providers
parent34eb18b30bac238d4abf2664dfe9f1f28808db29 (diff)
downloadgsoc2013-evolution-0297c01437237045337130d80cfd9da6f0a270de.tar
gsoc2013-evolution-0297c01437237045337130d80cfd9da6f0a270de.tar.gz
gsoc2013-evolution-0297c01437237045337130d80cfd9da6f0a270de.tar.bz2
gsoc2013-evolution-0297c01437237045337130d80cfd9da6f0a270de.tar.lz
gsoc2013-evolution-0297c01437237045337130d80cfd9da6f0a270de.tar.xz
gsoc2013-evolution-0297c01437237045337130d80cfd9da6f0a270de.tar.zst
gsoc2013-evolution-0297c01437237045337130d80cfd9da6f0a270de.zip
Added a note to the comment block for this function noting that uids MUST
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. svn path=/trunk/; revision=21173
Diffstat (limited to 'camel/providers')
-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
3 files changed, 21 insertions, 20 deletions
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()
**/