aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-05-03 00:50:43 +0800
committerDan Winship <danw@src.gnome.org>2001-05-03 00:50:43 +0800
commitd01a793455262a8e460a14e131b77d702f74d87f (patch)
tree5a135bc34c276a8f4019fc3d0c411d1236319915 /camel/providers/imap
parent42233e110afff81757e037cd292b0302b1e18809 (diff)
downloadgsoc2013-evolution-d01a793455262a8e460a14e131b77d702f74d87f.tar
gsoc2013-evolution-d01a793455262a8e460a14e131b77d702f74d87f.tar.gz
gsoc2013-evolution-d01a793455262a8e460a14e131b77d702f74d87f.tar.bz2
gsoc2013-evolution-d01a793455262a8e460a14e131b77d702f74d87f.tar.lz
gsoc2013-evolution-d01a793455262a8e460a14e131b77d702f74d87f.tar.xz
gsoc2013-evolution-d01a793455262a8e460a14e131b77d702f74d87f.tar.zst
gsoc2013-evolution-d01a793455262a8e460a14e131b77d702f74d87f.zip
Fix this up... it was losing count in some cases and giving a more verbose
* 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. svn path=/trunk/; revision=9644
Diffstat (limited to 'camel/providers/imap')
-rw-r--r--camel/providers/imap/camel-imap-utils.c22
1 files changed, 8 insertions, 14 deletions
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;