aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/imap/camel-imap-utils.c')
-rw-r--r--camel/providers/imap/camel-imap-utils.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 0d61373b6e..3f581b0c17 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -585,8 +585,11 @@ get_summary_uid_numeric (CamelFolderSummary *summary, int index)
* @summary: summary for the folder the UIDs come from
* @uids: a (sorted) array of UIDs
*
- * Return value: an IMAP "set" covering the listed UIDs, which the
- * caller must free with g_free().
+ * Creates an IMAP "set" covering the listed UIDs and not covering
+ * any UIDs that are in @summary but not in @uids. It doesn't
+ * actually require that all (or any) of the UIDs be in @summary.
+ *
+ * Return value: the set, which the caller must free with g_free()
**/
char *
imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids)
@@ -597,6 +600,8 @@ imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids)
GString *gset;
char *set;
+ g_return_val_if_fail (uids->len > 0, NULL);
+
gset = g_string_new (uids->pdata[0]);
last_uid = strtoul (uids->pdata[0], NULL, 10);
next_summary_uid = 0;
@@ -613,7 +618,7 @@ imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids)
/* Now get the next UID from @uids */
this_uid = strtoul (uids->pdata[ui], NULL, 10);
- if (this_uid == next_summary_uid)
+ if (this_uid == next_summary_uid || this_uid == last_uid + 1)
range = TRUE;
else {
if (range) {