Index: camel/providers/imap/camel-imap-store.c
===================================================================
--- camel/providers/imap/camel-imap-store.c	(revision 9058)
+++ camel/providers/imap/camel-imap-store.c	(working copy)
@@ -2598,9 +2598,25 @@ get_folders_sync(CamelImapStore *imap_st
 				if (((fi->flags ^ si->flags) & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED)) {
 					si->flags = (si->flags & ~CAMEL_FOLDER_SUBSCRIBED) | (fi->flags & CAMEL_FOLDER_SUBSCRIBED);
 					camel_store_summary_touch((CamelStoreSummary *)imap_store->summary);
+
+					camel_object_trigger_event (CAMEL_OBJECT (imap_store), "folder_created", fi);
+					camel_object_trigger_event (CAMEL_OBJECT (imap_store), "folder_subscribed", fi);
 				}
 			} else {
-				camel_store_summary_remove((CamelStoreSummary *)imap_store->summary, si);
+				char *dup_folder_name = g_strdup (camel_store_info_path (imap_store->summary, si));
+
+				if (dup_folder_name) {
+					CamelException eex;
+
+					camel_exception_init (&eex);
+					imap_folder_effectively_unsubscribed (imap_store, dup_folder_name, &eex);
+					imap_forget_folder (imap_store, dup_folder_name, &eex);
+
+					g_free (dup_folder_name);
+					camel_exception_clear (&eex);
+				} else
+					camel_store_summary_remove ((CamelStoreSummary *)imap_store->summary, si);
+
 				count--;
 				i--;
 			}
Index: camel/providers/imap/ChangeLog
===================================================================
--- camel/providers/imap/ChangeLog	(revision 9058)
+++ camel/providers/imap/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2008-06-27  Milan Crha  <mcrha@redhat.com>
+
+	** Fix for bug #330838
+
+	* camel-imap-store.c: (get_folders_sync): Notify application about
+	server folder changes as soon as we know about them.
+
 2008-06-24  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #531712
