Cache the folder-info on the summary if successful. (imap4_delete_folder):
2004-11-01 Jeffrey Stedfast <fejj@novell.com> * providers/imap4/camel-imap4-store.c (imap4_create_folder): Cache the folder-info on the summary if successful. (imap4_delete_folder): Un-cache the folder-info from the summary. * providers/imap4/camel-imap4-store-summary.c (load_namespaces): Cleaned up a bit. (save_namespaces): Same. (camel_imap4_store_summary_unnote_info): New function. (camel_imap4_store_summary_get_folder_info): Fixed the logic a bit. svn path=/trunk/; revision=27782
This commit is contained in:
committed by
Jeffrey Stedfast
parent
69d4437179
commit
609e3620b7
@ -1,8 +1,15 @@
|
||||
2004-11-01 Jeffrey Stedfast <fejj@novell.com>
|
||||
|
||||
* providers/imap4/camel-imap4-store.c (imap4_create_folder): Cache
|
||||
the folder-info on the summary if successful.
|
||||
(imap4_delete_folder): Un-cache the folder-info from the summary.
|
||||
|
||||
* providers/imap4/camel-imap4-store-summary.c (load_namespaces):
|
||||
Cleaned up a bit.
|
||||
(save_namespaces): Same.
|
||||
(camel_imap4_store_summary_unnote_info): New function.
|
||||
(camel_imap4_store_summary_get_folder_info): Fixed the logic a
|
||||
bit.
|
||||
|
||||
2004-10-28 Jeffrey Stedfast <fejj@ximian.com>
|
||||
|
||||
|
||||
@ -334,6 +334,17 @@ camel_imap4_store_summary_note_info (CamelIMAP4StoreSummary *s, CamelFolderInfo
|
||||
si->total = fi->total;
|
||||
|
||||
camel_store_summary_add (ss, si);
|
||||
|
||||
/* FIXME: should this be recursive? */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
camel_imap4_store_summary_unnote_info (CamelIMAP4StoreSummary *s, CamelFolderInfo *fi)
|
||||
{
|
||||
CamelStoreSummary *ss = (CamelStoreSummary *) s;
|
||||
|
||||
camel_store_summary_remove_path (ss, fi->full_name);
|
||||
}
|
||||
|
||||
|
||||
@ -363,9 +374,6 @@ camel_imap4_store_summary_get_folder_info (CamelIMAP4StoreSummary *s, const char
|
||||
size_t toplen, len;
|
||||
int i;
|
||||
|
||||
if (top == NULL)
|
||||
top = "";
|
||||
|
||||
toplen = strlen (top);
|
||||
folders = g_ptr_array_new ();
|
||||
|
||||
@ -374,7 +382,7 @@ camel_imap4_store_summary_get_folder_info (CamelIMAP4StoreSummary *s, const char
|
||||
if (strncmp (si->path, top, toplen) != 0)
|
||||
continue;
|
||||
|
||||
if ((len = strlen (si->path)) > toplen && si->path[toplen] != '/')
|
||||
if (toplen > 0 && (len = strlen (si->path)) > toplen && si->path[toplen] != '/')
|
||||
continue;
|
||||
|
||||
if (len == toplen) {
|
||||
|
||||
@ -81,6 +81,8 @@ void camel_imap4_store_summary_set_namespaces (CamelIMAP4StoreSummary *s, const
|
||||
/* add the info to the cache if we don't already have it, otherwise do nothing */
|
||||
void camel_imap4_store_summary_note_info (CamelIMAP4StoreSummary *s, struct _CamelFolderInfo *fi);
|
||||
|
||||
void camel_imap4_store_summary_unnote_info (CamelIMAP4StoreSummary *s, struct _CamelFolderInfo *fi);
|
||||
|
||||
struct _CamelFolderInfo *camel_imap4_store_summary_get_folder_info (CamelIMAP4StoreSummary *s, const char *top, guint32 flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -793,6 +793,8 @@ imap4_create_folder (CamelStore *store, const char *parent_name, const char *fol
|
||||
fi->unread = -1;
|
||||
fi->total = -1;
|
||||
|
||||
camel_imap4_store_summary_note_info (((CamelIMAP4Store *) store)->summary, fi);
|
||||
|
||||
camel_object_trigger_event (store, "folder_created", fi);
|
||||
break;
|
||||
case CAMEL_IMAP4_RESULT_NO:
|
||||
@ -893,6 +895,8 @@ imap4_delete_folder (CamelStore *store, const char *folder_name, CamelException
|
||||
fi->unread = -1;
|
||||
fi->total = -1;
|
||||
|
||||
camel_imap4_store_summary_unnote_info (((CamelIMAP4Store *) store)->summary, fi);
|
||||
|
||||
camel_object_trigger_event (store, "folder_deleted", fi);
|
||||
|
||||
camel_folder_info_free (fi);
|
||||
@ -959,6 +963,7 @@ imap4_rename_folder (CamelStore *store, const char *old_name, const char *new_na
|
||||
switch (ic->result) {
|
||||
case CAMEL_IMAP4_RESULT_OK:
|
||||
/* FIXME: need to update state on the renamed folder object */
|
||||
/* FIXME: need to update cached summary info too */
|
||||
break;
|
||||
case CAMEL_IMAP4_RESULT_NO:
|
||||
/* FIXME: would be good to save the NO reason into the err message */
|
||||
@ -1154,10 +1159,16 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE
|
||||
char wildcard;
|
||||
int id, i;
|
||||
|
||||
if (top == NULL)
|
||||
top = "";
|
||||
|
||||
CAMEL_SERVICE_LOCK (store, connect_lock);
|
||||
|
||||
if (!camel_session_is_online (session) || engine->state == CAMEL_IMAP4_ENGINE_DISCONNECTED) {
|
||||
fprintf (stderr, "****************************************************\n");
|
||||
fprintf (stderr, "*** Getting folder info in disconnected state... ***\n");
|
||||
fi = camel_imap4_store_summary_get_folder_info (((CamelIMAP4Store *) store)->summary, top, flags);
|
||||
fprintf (stderr, "****************************************************\n");
|
||||
if (fi == NULL && camel_session_is_online (session)) {
|
||||
/* folder info hasn't yet been cached and the store hasn't been
|
||||
* connected yet, but the network is available so we can connect
|
||||
@ -1180,9 +1191,6 @@ imap4_get_folder_info (CamelStore *store, const char *top, guint32 flags, CamelE
|
||||
else
|
||||
cmd = "LIST";
|
||||
|
||||
if (top == NULL)
|
||||
top = "";
|
||||
|
||||
wildcard = (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) ? '*' : '%';
|
||||
pattern = imap4_folder_utf7_name (store, top, wildcard);
|
||||
array = g_ptr_array_new ();
|
||||
|
||||
Reference in New Issue
Block a user