diff options
Diffstat (limited to 'camel/providers/imap4')
-rw-r--r-- | camel/providers/imap4/camel-imap4-folder.c | 19 | ||||
-rw-r--r-- | camel/providers/imap4/camel-imap4-store.c | 10 |
2 files changed, 22 insertions, 7 deletions
diff --git a/camel/providers/imap4/camel-imap4-folder.c b/camel/providers/imap4/camel-imap4-folder.c index ebc75330de..ef70c82634 100644 --- a/camel/providers/imap4/camel-imap4-folder.c +++ b/camel/providers/imap4/camel-imap4-folder.c @@ -172,6 +172,7 @@ camel_imap4_folder_new (CamelStore *store, const char *full_name, CamelException { CamelIMAP4Folder *imap_folder; char *utf7_name, *name, *p; + CamelFolder *folder; char sep; if (!(p = strrchr (full_name, '/'))) @@ -197,11 +198,23 @@ camel_imap4_folder_new (CamelStore *store, const char *full_name, CamelException utf7_name = camel_utf8_utf7 (utf7_name); - imap_folder = (CamelIMAP4Folder *) camel_object_new (CAMEL_TYPE_IMAP4_FOLDER); - camel_folder_construct ((CamelFolder *) imap_folder, store, full_name, name); + folder = (CamelFolder *) imap_folder = (CamelIMAP4Folder *) camel_object_new (CAMEL_TYPE_IMAP4_FOLDER); + camel_folder_construct (folder, store, full_name, name); imap_folder->utf7_name = utf7_name; - return (CamelFolder *) imap_folder; + folder->summary = camel_imap4_summary_new (folder); + + if (camel_imap4_engine_select_folder (((CamelIMAP4Store *) store)->engine, folder, ex) == -1) { + camel_object_unref (folder); + folder = NULL; + } + + if (camel_imap4_summary_flush_updates (folder->summary, ex) == -1) { + camel_object_unref (folder); + folder = NULL; + } + + return folder; } diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c index 4c8d701ecf..e9caff509a 100644 --- a/camel/providers/imap4/camel-imap4-store.c +++ b/camel/providers/imap4/camel-imap4-store.c @@ -693,7 +693,7 @@ imap4_get_folder (CamelStore *store, const char *folder_name, guint32 flags, Cam /* make sure the folder exists - try LISTing it? */ utf7_name = imap4_folder_utf7_name (store, folder_name, '\0'); - ic = camel_imap4_engine_queue (engine, NULL, "LIST "" %S\r\n", utf7_name); + ic = camel_imap4_engine_queue (engine, NULL, "LIST \"\" %S\r\n", utf7_name); camel_imap4_command_register_untagged (ic, "LIST", camel_imap4_untagged_list); ic->user_data = array = g_ptr_array_new (); g_free (utf7_name); @@ -1001,9 +1001,13 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE char *pattern; int id, i; + CAMEL_SERVICE_LOCK (store, connect_lock); + if (engine == NULL) { if (!camel_service_connect ((CamelService *) store, ex)) return NULL; + + engine = ((CamelIMAP4Store *) store)->engine; } if (flags & CAMEL_STORE_FOLDER_INFO_SUBSCRIBED) @@ -1014,10 +1018,8 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE if (top == NULL) top = ""; - CAMEL_SERVICE_LOCK (store, connect_lock); - pattern = imap4_folder_utf7_name (store, top, (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) ? '*' : '%'); - ic = camel_imap4_engine_queue (engine, NULL, "%s "" %S\r\n", cmd, pattern); + ic = camel_imap4_engine_queue (engine, NULL, "%s \"\" %S\r\n", cmd, pattern); camel_imap4_command_register_untagged (ic, cmd, camel_imap4_untagged_list); ic->user_data = array = g_ptr_array_new (); |