From a4f3321ccbeb606a113261062914d5e42dc61aed Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 4 Jun 2004 19:10:15 +0000 Subject: Initialise the folder->summary and force an update of the message info 2004-06-04 Jeffrey Stedfast * providers/imap4/camel-imap4-folder.c (camel_imap4_folder_new): Initialise the folder->summary and force an update of the message info cache by selecting the folder and flushing the updates to the imap4 summary object. * providers/imap4/camel-imap4-store.c (imap4_get_folder_info): Lock the connect_lock before we check if the engine is NULL and after we connect (assuming we need to), initialise the engine pointer again. (imap4_get_folder_info): Doh. Need to escape the "'s in the LIST command string. (imap4_get_folder): Same. svn path=/trunk/; revision=26221 --- camel/ChangeLog | 13 +++++++++++++ camel/providers/imap4/camel-imap4-folder.c | 19 ++++++++++++++++--- camel/providers/imap4/camel-imap4-store.c | 10 ++++++---- 3 files changed, 35 insertions(+), 7 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 67442996ed..d3baec3e57 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,18 @@ 2004-06-04 Jeffrey Stedfast + * providers/imap4/camel-imap4-folder.c (camel_imap4_folder_new): + Initialise the folder->summary and force an update of the message + info cache by selecting the folder and flushing the updates to the + imap4 summary object. + + * providers/imap4/camel-imap4-store.c (imap4_get_folder_info): + Lock the connect_lock before we check if the engine is NULL and + after we connect (assuming we need to), initialise the engine + pointer again. + (imap4_get_folder_info): Doh. Need to escape the "'s in the LIST + command string. + (imap4_get_folder): Same. + * camel-stream-buffer.c (stream_flush): Fixed to work properly. After we've flushed the buffer, we want to set sbf->ptr to sbf->buf, we don't want to do sbf->ptr += written, that'll just 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 (); -- cgit v1.2.3