Index: camel/providers/imap/ChangeLog
===================================================================
--- camel/providers/imap/ChangeLog	(revision 9042)
+++ camel/providers/imap/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2008-06-25  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #324804
+
+	* camel-imap-private.h: (struct _CamelImapFolderPrivate):
+	* camel-imap-folder.c: (camel_imap_folder_init),
+	(camel_imap_folder_selected), (imap_update_summary):
+	Report only \Recent messages as new when summary gets invalid.
+
 2008-06-24  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #531712
Index: camel/providers/imap/camel-imap-folder.c
===================================================================
--- camel/providers/imap/camel-imap-folder.c	(revision 9042)
+++ camel/providers/imap/camel-imap-folder.c	(working copy)
@@ -204,6 +204,7 @@ camel_imap_folder_init (gpointer object,
 	g_static_mutex_init(&imap_folder->priv->search_lock);
 	g_static_rec_mutex_init(&imap_folder->priv->cache_lock);
 #endif
+	imap_folder->priv->invalidated = FALSE;
 
 	imap_folder->need_rescan = TRUE;
 }
@@ -362,12 +363,14 @@ camel_imap_folder_selected (CamelFolder 
 		imap_summary->validity = validity;
 	else if (validity != imap_summary->validity) {
 		imap_summary->validity = validity;
+		imap_folder->priv->invalidated = TRUE;
 		camel_folder_summary_clear (folder->summary);
 		CAMEL_IMAP_FOLDER_REC_LOCK (imap_folder, cache_lock);
 		camel_imap_message_cache_clear (imap_folder->cache);
 		CAMEL_IMAP_FOLDER_REC_UNLOCK (imap_folder, cache_lock);
 		imap_folder->need_rescan = FALSE;
 		camel_imap_folder_changed (folder, exists, NULL, ex);
+		imap_folder->priv->invalidated = FALSE;
 		return;
 	}
 	
@@ -3104,7 +3107,7 @@ imap_update_summary (CamelFolder *folder
 
 		/* report all new messages as recent, even without that flag, thus new
 		   messages will be filtered even after saw by other software earlier */
-		if ((mi->info.flags & CAMEL_IMAP_MESSAGE_RECENT) != 0 || getenv ("FILTER_RECENT") == NULL)
+		if ((mi->info.flags & CAMEL_IMAP_MESSAGE_RECENT) != 0 || (!imap_folder->priv->invalidated && getenv ("FILTER_RECENT") == NULL))
 			camel_folder_change_info_recent_uid (changes, camel_message_info_uid (mi));
 	}
 
Index: camel/providers/imap/camel-imap-private.h
===================================================================
--- camel/providers/imap/camel-imap-private.h	(revision 9042)
+++ camel/providers/imap/camel-imap-private.h	(working copy)
@@ -15,6 +15,7 @@ struct _CamelImapFolderPrivate {
 	GStaticMutex search_lock;	/* for locking the search object */
 	GStaticRecMutex cache_lock;	/* for locking the cache object */
 #endif
+	gboolean invalidated;
 };
 
 #ifdef ENABLE_THREADS
