Index: mail/ChangeLog
===================================================================
--- mail/ChangeLog	(revision 34514)
+++ mail/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2007-11-08  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #336074
+
+	* mail-send-recv.c: (get_folders):
+	Determine whether refresh folder from the store based on result of new
+	store's function 'camel_store_can_refresh_folder'.
+
 2007-11-05  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #343011
Index: mail/mail-send-recv.c
===================================================================
--- mail/mail-send-recv.c	(revision 34514)
+++ mail/mail-send-recv.c	(working copy)
@@ -840,21 +840,17 @@
 };
 
 static void
-get_folders(CamelStore *store, GPtrArray *folders, CamelFolderInfo *info)
+get_folders (CamelStore *store, GPtrArray *folders, CamelFolderInfo *info)
 {
 	while (info) {
-		/* FIXME: this is hardcoded temporarily, until the backend itself
-		   controls this refresh process.
-		   TODO: add virtual camel_store_refresh_info() which does this ... */
-		if (camel_url_get_param(((CamelService *)store)->url, "check_all") != NULL
-				|| (strcmp(((CamelService *)store)->url->protocol, "imap") != 0
-					&& strcmp(((CamelService *)store)->url->protocol, "groupwise") != 0
-					&& strcmp(((CamelService *)store)->url->protocol, "scalix") != 0
-					&& strcmp(((CamelService *)store)->url->protocol, "exchange") != 0 )
+		CamelException ex;
 
-				|| (info->flags & CAMEL_FOLDER_TYPE_MASK) == CAMEL_FOLDER_TYPE_INBOX)
-			g_ptr_array_add(folders, g_strdup(info->uri));
-		get_folders(store, folders, info->child);
+		camel_exception_init (&ex);
+		if (camel_store_can_refresh_folder (store, info, &ex))
+			g_ptr_array_add (folders, g_strdup (info->uri));
+		camel_exception_clear (&ex);
+
+		get_folders (store, folders, info->child);
 		info = info->next;
 	}
 }
