diff options
author | Jeffrey Stedfast <fejj@helixcode.com> | 2000-08-31 12:19:23 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-08-31 12:19:23 +0800 |
commit | 2f478348f575be5846df82c4cedeac89e6eab31c (patch) | |
tree | 58da749293aae57e2162669e0e1d50c5dbdb3e07 /camel/providers | |
parent | 3de9db5ae79348a641351f6141b282ce5e9b50a9 (diff) | |
download | gsoc2013-evolution-2f478348f575be5846df82c4cedeac89e6eab31c.tar gsoc2013-evolution-2f478348f575be5846df82c4cedeac89e6eab31c.tar.gz gsoc2013-evolution-2f478348f575be5846df82c4cedeac89e6eab31c.tar.bz2 gsoc2013-evolution-2f478348f575be5846df82c4cedeac89e6eab31c.tar.lz gsoc2013-evolution-2f478348f575be5846df82c4cedeac89e6eab31c.tar.xz gsoc2013-evolution-2f478348f575be5846df82c4cedeac89e6eab31c.tar.zst gsoc2013-evolution-2f478348f575be5846df82c4cedeac89e6eab31c.zip |
Don't save any exceptions caused by camel_imap_folder_changed
2000-08-31 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-store.c (camel_imap_command_extended):
Don't save any exceptions caused by camel_imap_folder_changed
(camel_imap_fetch_command): Same.
* providers/imap/camel-imap-folder.c (camel_imap_folder_changed):
Using a new way of calculating the first recent message that seems
more accurate. Also added code to make sure we don't accidently
add a duplicate summary.
svn path=/trunk/; revision=5135
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/imap/camel-imap-folder.c | 28 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 22 |
2 files changed, 40 insertions, 10 deletions
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index 5744a61584..c4c26db300 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -1482,7 +1482,7 @@ camel_imap_folder_changed (CamelFolder *folder, gint recent, GPtrArray *expunged if (recent > 0) { CamelImapFolder *imap_folder = CAMEL_IMAP_FOLDER (folder); CamelMessageInfo *info; - gint i, j, last; + gint i, j, last, slast; if (!imap_folder->summary) { imap_folder->summary = g_ptr_array_new (); @@ -1490,12 +1490,32 @@ camel_imap_folder_changed (CamelFolder *folder, gint recent, GPtrArray *expunged } last = imap_folder->summary->len + 1; + slast = imap_get_message_count_internal (folder, ex); + fprintf (stderr, "calculated next message is: %d\n", last); + fprintf (stderr, "server says %d mesgs total\n", slast); + slast -= (recent - 1); + fprintf (stderr, "based on total, new guess is: %d\n", slast); - for (i = last, j = 0; j < recent; i++, j++) { + for (i = slast, j = 0; j < recent; i++, j++) { info = imap_get_message_info_internal (folder, i, ex); if (info) { - g_ptr_array_add (imap_folder->summary, info); - g_hash_table_insert (imap_folder->summary_hash, info->uid, info); + if (!imap_get_message_info (folder, info->uid)) { + /* add to our summary */ + g_ptr_array_add (imap_folder->summary, info); + g_hash_table_insert (imap_folder->summary_hash, info->uid, info); + } else { + /* we already have a record of it */ + g_free (info->subject); + g_free (info->from); + g_free (info->to); + g_free (info->cc); + g_free (info->uid); + g_free (info->message_id); + header_references_list_clear (&info->references); + g_free (info); + info = NULL; + d(fprintf (stderr, "we already had message %d!!\n", i)); + } } else { /* our hack failed so now we need to do it the old fashioned way */ /*imap_get_summary_internal (folder, ex);*/ diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 4be5300e70..820c2453ce 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -785,8 +785,13 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** } /* Update the summary */ - if (folder && (recent > 0 || expunged->len > 0)) - camel_imap_folder_changed (folder, recent, expunged, ex); + if (folder && (recent > 0 || expunged->len > 0)) { + CamelException dex; + + camel_exception_init (&dex); + camel_imap_folder_changed (folder, recent, expunged, &dex); + camel_exception_clear (&dex); + } for (i = 0; i < data->len; i++) g_free (data->pdata[i]); @@ -826,7 +831,7 @@ camel_imap_command_extended (CamelImapStore *store, CamelFolder *folder, char ** gint camel_imap_fetch_command (CamelImapStore *store, CamelFolder *folder, char **ret, CamelException *ex, char *fmt, ...) { - /* Security Note/FIXME: We have to be careful about assuming + /* Security Note: We have to be careful about assuming * that a server response is valid as the command we are * calling may require a literal string response which could * possibly contain strings that appear to be valid server @@ -1008,8 +1013,13 @@ camel_imap_fetch_command (CamelImapStore *store, CamelFolder *folder, char **ret } /* Update the summary */ - if (folder && (recent > 0 || expunged->len > 0)) - camel_imap_folder_changed (folder, recent, expunged, ex); + if (folder && (recent > 0 || expunged->len > 0)) { + CamelException dex; + + camel_exception_init (&dex); + camel_imap_folder_changed (folder, recent, expunged, &dex); + camel_exception_clear (&dex); + } for (i = 0; i < data->len; i++) g_free (data->pdata[i]); @@ -1289,7 +1299,7 @@ camel_imap_command_continuation_with_stream (CamelImapStore *store, char **ret, "IMAP command failed: %s", word); } else { camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, - "IMAP command failed: Unknown"); + "IMAP command failed: Unknown error"); } *ret = NULL; |