aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap/camel-imap-folder.c
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2001-01-12 06:50:10 +0800
committerDan Winship <danw@src.gnome.org>2001-01-12 06:50:10 +0800
commita974fb1de3f0d98def12d34baa15b83ad3a48eff (patch)
treeaa9f534477138db8b193b9ed7a7e289afc32b8a8 /camel/providers/imap/camel-imap-folder.c
parentec3f086d9fc1c59044de4c8c99d985b752b44cc6 (diff)
downloadgsoc2013-evolution-a974fb1de3f0d98def12d34baa15b83ad3a48eff.tar
gsoc2013-evolution-a974fb1de3f0d98def12d34baa15b83ad3a48eff.tar.gz
gsoc2013-evolution-a974fb1de3f0d98def12d34baa15b83ad3a48eff.tar.bz2
gsoc2013-evolution-a974fb1de3f0d98def12d34baa15b83ad3a48eff.tar.lz
gsoc2013-evolution-a974fb1de3f0d98def12d34baa15b83ad3a48eff.tar.xz
gsoc2013-evolution-a974fb1de3f0d98def12d34baa15b83ad3a48eff.tar.zst
gsoc2013-evolution-a974fb1de3f0d98def12d34baa15b83ad3a48eff.zip
Fix a bug in previous commit: don't check for deleted messages if there
* providers/imap/camel-imap-folder.c (camel_imap_folder_selected): Fix a bug in previous commit: don't check for deleted messages if there are no known messages in the folder (because it would end up sending "FETCH 0 ..."). svn path=/trunk/; revision=7412
Diffstat (limited to 'camel/providers/imap/camel-imap-folder.c')
-rw-r--r--camel/providers/imap/camel-imap-folder.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index d3ba77478e..562b989057 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -237,37 +237,40 @@ camel_imap_folder_selected (CamelFolder *folder, CamelImapResponse *response,
return;
}
- /* Similarly, if the UID of the highest message we know about
- * has changed, then that indicates that messages have been
- * both added and removed, so we have to rescan to find the
- * removed ones. (We pass NULL for the folder since we know
- * that this folder is selected, and we don't want
- * camel_imap_command to worry about it.)
- */
- response = camel_imap_command (CAMEL_IMAP_STORE (folder->parent_store),
- NULL, ex, "FETCH %d UID", count);
- if (!response)
- return;
- uid = 0;
- for (i = 0; i < response->untagged->len; i++) {
- resp = response->untagged->pdata[i];
- val = strtoul (resp + 2, &resp, 10);
- if (val != count || g_strncasecmp (resp, " FETCH (", 8) != 0)
- continue;
- resp = e_strstrcase (resp, "UID ");
- if (!resp)
- continue;
- uid = strtoul (resp + 4, NULL, 10);
- break;
- }
- camel_imap_response_free (response);
+ if (count != 0) {
+ /* Similarly, if the UID of the highest message we
+ * know about has changed, then that indicates that
+ * messages have been both added and removed, so we
+ * have to rescan to find the removed ones. (We pass
+ * NULL for the folder since we know that this folder
+ * is selected, and we don't want camel_imap_command
+ * to worry about it.)
+ */
+ response = camel_imap_command (CAMEL_IMAP_STORE (folder->parent_store),
+ NULL, ex, "FETCH %d UID", count);
+ if (!response)
+ return;
+ uid = 0;
+ for (i = 0; i < response->untagged->len; i++) {
+ resp = response->untagged->pdata[i];
+ val = strtoul (resp + 2, &resp, 10);
+ if (val != count || g_strncasecmp (resp, " FETCH (", 8) != 0)
+ continue;
+ resp = e_strstrcase (resp, "UID ");
+ if (!resp)
+ continue;
+ uid = strtoul (resp + 4, NULL, 10);
+ break;
+ }
+ camel_imap_response_free (response);
- info = camel_folder_summary_index (folder->summary, count - 1);
- val = strtoul (camel_message_info_uid (info), NULL, 10);
- camel_folder_summary_info_free (folder->summary, info);
- if (uid == 0 || uid != val) {
- imap_rescan (folder, exists, ex);
- return;
+ info = camel_folder_summary_index (folder->summary, count - 1);
+ val = strtoul (camel_message_info_uid (info), NULL, 10);
+ camel_folder_summary_info_free (folder->summary, info);
+ if (uid == 0 || uid != val) {
+ imap_rescan (folder, exists, ex);
+ return;
+ }
}
/* OK. So now we know that no messages have been expunged. Whew.