Index: mail/ChangeLog
===================================================================
--- mail/ChangeLog	(revision 35415)
+++ mail/ChangeLog	(working copy)
@@ -1,3 +1,11 @@
+2008-04-26  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #317755
+
+	* mail-send-recv.c: (refresh_folders_exec):
+	* mail-ops.c: (refresh_folder_desc):
+	Also sync with a server when refreshing folder.
+
 2008-04-25  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #273041
Index: mail/mail-send-recv.c
===================================================================
--- mail/mail-send-recv.c	(revision 35413)
+++ mail/mail-send-recv.c	(working copy)
@@ -829,6 +829,8 @@ refresh_folders_exec (struct _refresh_fo
 	for (i=0;i<m->folders->len;i++) {
 		folder = mail_tool_uri_to_folder(m->folders->pdata[i], 0, &ex);
 		if (folder) {
+			camel_folder_sync (folder, FALSE, &ex);
+			camel_exception_clear(&ex);
 			camel_folder_refresh_info(folder, &ex);
 			camel_exception_clear(&ex);
 			camel_object_unref(folder);
Index: mail/mail-ops.c
===================================================================
--- mail/mail-ops.c	(revision 35413)
+++ mail/mail-ops.c	(working copy)
@@ -1620,7 +1620,10 @@ refresh_folder_desc (struct _sync_folder
 static void
 refresh_folder_exec (struct _sync_folder_msg *m)
 {
-	camel_folder_refresh_info(m->folder, &m->base.ex);
+	camel_folder_sync (m->folder, FALSE, &m->base.ex);
+
+	if (!camel_exception_is_set (&m->base.ex))
+		camel_folder_refresh_info(m->folder, &m->base.ex);
 }
 
 /* we just use the sync stuff where we can, since it would be the same */
