aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/imap4/camel-imap4-summary.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-06-11 13:33:51 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-06-11 13:33:51 +0800
commit3c86a0c57cab32e0042cc58c347b2843274b9a03 (patch)
tree676c0cec39af0b57ccd2091274f7a1939a7ab997 /camel/providers/imap4/camel-imap4-summary.c
parentf1d2d8caa47470d301eef390b403e94600e444ba (diff)
downloadgsoc2013-evolution-3c86a0c57cab32e0042cc58c347b2843274b9a03.tar
gsoc2013-evolution-3c86a0c57cab32e0042cc58c347b2843274b9a03.tar.gz
gsoc2013-evolution-3c86a0c57cab32e0042cc58c347b2843274b9a03.tar.bz2
gsoc2013-evolution-3c86a0c57cab32e0042cc58c347b2843274b9a03.tar.lz
gsoc2013-evolution-3c86a0c57cab32e0042cc58c347b2843274b9a03.tar.xz
gsoc2013-evolution-3c86a0c57cab32e0042cc58c347b2843274b9a03.tar.zst
gsoc2013-evolution-3c86a0c57cab32e0042cc58c347b2843274b9a03.zip
Don't bother scanning summary info if EXISTS was 0.
2004-06-11 Jeffrey Stedfast <fejj@ximian.com> * providers/imap4/camel-imap4-summary.c (camel_imap4_summary_flush_updates): Don't bother scanning summary info if EXISTS was 0. (camel_imap4_summary_set_uidvalidity): Emit the folder_changed event after clearing the summary. (camel_imap4_summary_expunge): Emit the folder_changed event after removing the message from the summary. * providers/imap4/camel-imap4-folder.c (imap4_sync): Flush updates after an EXPUNGE and don't unset expunge if we didn't delete anything (the logic was wrong anyway). (imap4_refresh_info): Implemented. svn path=/trunk/; revision=26300
Diffstat (limited to 'camel/providers/imap4/camel-imap4-summary.c')
-rw-r--r--camel/providers/imap4/camel-imap4-summary.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/camel/providers/imap4/camel-imap4-summary.c b/camel/providers/imap4/camel-imap4-summary.c
index 8ef8d342fa..f68f892153 100644
--- a/camel/providers/imap4/camel-imap4-summary.c
+++ b/camel/providers/imap4/camel-imap4-summary.c
@@ -998,15 +998,30 @@ void
camel_imap4_summary_set_uidvalidity (CamelFolderSummary *summary, guint32 uidvalidity)
{
CamelIMAP4Summary *imap4_summary = (CamelIMAP4Summary *) summary;
+ CamelFolderChangeInfo *changes;
+ CamelMessageInfo *info;
+ int i, count;
g_return_if_fail (CAMEL_IS_IMAP4_SUMMARY (summary));
if (imap4_summary->uidvalidity == uidvalidity)
return;
- /* FIXME: emit a signal or something first? */
+ changes = camel_folder_change_info_new ();
+ count = camel_folder_summary_count (summary);
+ for (i = 0; i < count; i++) {
+ if (!(info = camel_folder_summary_index (summary, i)))
+ continue;
+
+ camel_folder_change_info_remove_uid (changes, camel_message_info_uid (info));
+ camel_folder_summary_info_free (summary, info);
+ }
+
camel_folder_summary_clear (summary);
+ camel_object_trigger_event (imap4_summary->folder, "folder_changed", changes);
+ camel_folder_change_info_free (changes);
+
imap4_summary->uidvalidity = uidvalidity;
imap4_summary->uidvalidity_changed = TRUE;
@@ -1015,6 +1030,8 @@ camel_imap4_summary_set_uidvalidity (CamelFolderSummary *summary, guint32 uidval
void
camel_imap4_summary_expunge (CamelFolderSummary *summary, int seqid)
{
+ CamelIMAP4Summary *imap4_summary = (CamelIMAP4Summary *) summary;
+ CamelFolderChangeInfo *changes;
CamelMessageInfo *info;
g_return_if_fail (CAMEL_IS_IMAP4_SUMMARY (summary));
@@ -1022,11 +1039,10 @@ camel_imap4_summary_expunge (CamelFolderSummary *summary, int seqid)
if (!(info = camel_folder_summary_index (summary, seqid)))
return;
- /* FIXME: emit a signal or something that our Folder can proxy
- * up to the app so that it can update its display and
- * whatnot? */
-
- /* emit signal */
+ changes = camel_folder_change_info_new ();
+ camel_folder_change_info_remove_uid (changes, camel_message_info_uid (info));
+ camel_object_trigger_event (imap4_summary->folder, "folder_changed", changes);
+ camel_folder_change_info_free (changes);
camel_folder_summary_info_free (summary, info);
camel_folder_summary_remove_index (summary, seqid);
@@ -1062,7 +1078,7 @@ camel_imap4_summary_flush_updates (CamelFolderSummary *summary, CamelException *
if (imap4_summary->uidvalidity_changed) {
first = 1;
- } else if (imap4_summary->exists_changed) {
+ } else if (imap4_summary->exists_changed && imap4_summary->exists > 0) {
scount = camel_folder_summary_count (summary);
ic = imap4_summary_fetch_flags (summary, 1, scount);
@@ -1082,7 +1098,7 @@ camel_imap4_summary_flush_updates (CamelFolderSummary *summary, CamelException *
camel_imap4_command_unref (ic);
}
- if (first != 0) {
+ if (first != 0 && imap4_summary->exists > 0) {
ic = imap4_summary_fetch_all (summary, first, 0);
while ((id = camel_imap4_engine_iterate (engine)) < ic->id && id != -1)