diff options
author | Jeffrey Stedfast <fejj@novell.com> | 2004-05-21 03:16:53 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2004-05-21 03:16:53 +0800 |
commit | bb332fc6a0c1ad636ebc7aeaa0db42deabe19407 (patch) | |
tree | fccf544bdb7e2e5fe1e1d82aa962c7ffd39dea2c /camel/providers | |
parent | c976418063aa604997502adb6b88054f0f2822cf (diff) | |
download | gsoc2013-evolution-bb332fc6a0c1ad636ebc7aeaa0db42deabe19407.tar gsoc2013-evolution-bb332fc6a0c1ad636ebc7aeaa0db42deabe19407.tar.gz gsoc2013-evolution-bb332fc6a0c1ad636ebc7aeaa0db42deabe19407.tar.bz2 gsoc2013-evolution-bb332fc6a0c1ad636ebc7aeaa0db42deabe19407.tar.lz gsoc2013-evolution-bb332fc6a0c1ad636ebc7aeaa0db42deabe19407.tar.xz gsoc2013-evolution-bb332fc6a0c1ad636ebc7aeaa0db42deabe19407.tar.zst gsoc2013-evolution-bb332fc6a0c1ad636ebc7aeaa0db42deabe19407.zip |
Fixes bug #42295 and the infinite loop part of bug #58766 (these 2 bugs
2004-05-20 Jeffrey Stedfast <fejj@novell.com>
Fixes bug #42295 and the infinite loop part of bug #58766 (these 2
bugs are almost identical, except the server responses are broken
in different ways).
* providers/imap/camel-imap-folder.c (imap_update_summary): Remove
the kludge to re-SELECT the folder to force a re-FETCH of
message-info's. This 1) doesn't do what it was meant to do and 2)
has a tendency to cause infinite loops with broken servers such as
Courier-IMAP.
(imap_update_summary): Rework the loop that adds messages to the
summary such that if we encounetr an error, we break out and set
an exception (we can keep the messages up to the point of failure,
but none after that because otherwise our uid-to-seqid mapping
would be inconsistant with that of the server and could
potentially cause data loss).
svn path=/trunk/; revision=26019
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index b75373a375..d2da841599 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -2459,19 +2459,33 @@ imap_update_summary (CamelFolder *folder, int exists, mi = messages->pdata[i]; if (!mi) { g_warning ("No information for message %d", i + first); - continue; + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Incomplete server response: no information provided for message %d"), + i + first); + break; } uid = (char *)camel_message_info_uid(mi); if (uid[0] == 0) { g_warning("Server provided no uid: message %d", i + first); - continue; + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Incomplete server response: no UID provided for message %d"), + i + first); + break; } info = camel_folder_summary_uid(folder->summary, uid); if (info) { + for (seq = 0; seq < camel_folder_summary_count (folder->summary); seq++) { + if (folder->summary->messages->pdata[seq] == info) + break; + } + g_warning("Message already present? %s", camel_message_info_uid(mi)); + camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, + _("Unexpected server response: Identical UIDs provided for messages %d and %d"), + seq + 1, i + first); + camel_folder_summary_info_free(folder->summary, info); - camel_folder_summary_info_free(folder->summary, mi); - continue; + break; } camel_folder_summary_add (folder->summary, mi); @@ -2480,27 +2494,14 @@ imap_update_summary (CamelFolder *folder, int exists, if ((mi->flags & CAMEL_IMAP_MESSAGE_RECENT)) camel_folder_change_info_recent_uid(changes, camel_message_info_uid (mi)); } - g_ptr_array_free (messages, TRUE); - /* Kludge around Microsoft Exchange 5.5 IMAP - See bug #5348 for details */ - if (camel_folder_summary_count (folder->summary) != exists) { - CamelImapStore *imap_store = (CamelImapStore *) folder->parent_store; - CamelImapResponse *response; - - /* forget the currently selected folder */ - if (imap_store->current_folder) { - camel_object_unref (CAMEL_OBJECT (imap_store->current_folder)); - imap_store->current_folder = NULL; - } - - /* now re-select it and process the EXISTS response */ - response = camel_imap_command (imap_store, folder, ex, NULL); - if (response) { - camel_imap_folder_selected (folder, response, NULL); - camel_imap_response_free (imap_store, response); - } + for ( ; i < messages->len; i++) { + if ((mi = messages->pdata[i])) + camel_folder_summary_info_free(folder->summary, mi); } + g_ptr_array_free (messages, TRUE); + return; lose: |