From 4318f82f0381150d57789dc9b707bf0ca448f0b3 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 17 Jun 2004 02:08:16 +0000 Subject: Added a 'first' member to the imap_fetch_all_t struct so we can use that 2004-06-16 Jeffrey Stedfast * providers/imap4/camel-imap4-summary.c: Added a 'first' member to the imap_fetch_all_t struct so we can use that as a base offset in our GPtrArray, allowing us to limit resource consumption which could otherwise get quite large. Also added a ChangeInfo member that was needed for changes to untagged_fetch_all(). (imap4_fetch_all_add): Use fetch->first as a base offset and change int i to guint32 i. Also updated to sue the fetch->changes. (imap4_fetch_all_update): Same. (untagged_fetch_all): Same - this is where it is really valuable, since we can avoid adding elements to the GPtrArray that we won't even use. Also needed to change code a big in case index < fetch->first (which could happen if a server notified us of a FLAGS change for a message we didn't request info about). (imap4_fetch_all_free): Free the ChangeInfo. (imap4_summary_fetch_all): Init fetch->changes and fetch->first. (imap4_summary_fetch_flags): Same. (camel_imap4_summary_flush_updates): Only request envelope info if first <= summary->exists. Avoids needless queries. (info_uid_sort): #if 0'd (camel_imap4_summary_flush_updates): No need to sort the summary - this should never have been needed. I can't remember why I did this... svn path=/trunk/; revision=26371 --- camel/providers/imap4/camel-imap4-summary.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/imap4/camel-imap4-summary.c b/camel/providers/imap4/camel-imap4-summary.c index a91b20dbbc..af53bcef4f 100644 --- a/camel/providers/imap4/camel-imap4-summary.c +++ b/camel/providers/imap4/camel-imap4-summary.c @@ -1163,7 +1163,7 @@ camel_imap4_summary_expunge (CamelFolderSummary *summary, int seqid) camel_folder_change_info_free (changes); } - +#if 0 static int info_uid_sort (const CamelMessageInfo **info0, const CamelMessageInfo **info1) { @@ -1177,6 +1177,7 @@ info_uid_sort (const CamelMessageInfo **info0, const CamelMessageInfo **info1) return uid0 < uid1 ? -1 : 1; } +#endif int camel_imap4_summary_flush_updates (CamelFolderSummary *summary, CamelException *ex) @@ -1218,7 +1219,7 @@ camel_imap4_summary_flush_updates (CamelFolderSummary *summary, CamelException * first = scount + 1; } - if (first != 0 && imap4_summary->exists > 0) { + if (first != 0 && first <= imap4_summary->exists) { ic = imap4_summary_fetch_all (summary, first, 0); while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1) @@ -1234,8 +1235,13 @@ camel_imap4_summary_flush_updates (CamelFolderSummary *summary, CamelException * imap4_fetch_all_add (ic->user_data); camel_imap4_command_unref (ic); +#if 0 + /* Note: this should not be needed - the code that adds envelopes to the summary + * adds them in proper order */ + /* it's important for these to be sorted sequentially for EXPUNGE events to work */ g_ptr_array_sort (summary->messages, (GCompareFunc) info_uid_sort); +#endif } imap4_summary->update_flags = FALSE; -- cgit v1.2.3