aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/providers/imap/camel-imap-utils.c22
2 files changed, 12 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index cc13b751d3..74da010682 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,9 @@
2001-05-02 Dan Winship <danw@ximian.com>
+ * providers/imap/camel-imap-utils.c (imap_uid_array_to_set): Fix
+ this up... it was losing count in some cases and giving a more
+ verbose answer than it needed to.
+
* providers/pop3/camel-pop3-store.c: Rescue the KPOP code from bit
rot.
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 59d6ac5ea8..0d61373b6e 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -599,29 +599,23 @@ imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids)
gset = g_string_new (uids->pdata[0]);
last_uid = strtoul (uids->pdata[0], NULL, 10);
+ next_summary_uid = 0;
scount = camel_folder_summary_count (summary);
for (ui = 1, si = 0; ui < uids->len; ui++) {
- /* Find the next UID in the summary */
- for (; si < scount; si++) {
- next_summary_uid = get_summary_uid_numeric (summary, si);
- if (next_summary_uid == last_uid)
- break;
- }
- if (++si < scount)
+ /* Find the next UID in the summary after the one we
+ * just wrote out.
+ */
+ for (; last_uid >= next_summary_uid && si < scount; si++)
next_summary_uid = get_summary_uid_numeric (summary, si);
- else
+ if (last_uid >= next_summary_uid)
next_summary_uid = (unsigned long) -1;
/* 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)
range = TRUE;
- if (++si < scount)
- next_summary_uid = get_summary_uid_numeric (summary, si);
- else
- next_summary_uid = (unsigned long) -1;
- } else {
+ else {
if (range) {
g_string_sprintfa (gset, ":%lu", last_uid);
range = FALSE;