aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-11-02 02:54:46 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-11-02 02:54:46 +0800
commit609e3620b733b5a4341d934e4825cab5d5d535bc (patch)
tree6ba6f37a2d142913849c936f33234da88db0ee56 /camel
parent69d4437179684dad21812702ead2b1e39d266cb4 (diff)
downloadgsoc2013-evolution-609e3620b733b5a4341d934e4825cab5d5d535bc.tar.gz
gsoc2013-evolution-609e3620b733b5a4341d934e4825cab5d5d535bc.tar.zst
gsoc2013-evolution-609e3620b733b5a4341d934e4825cab5d5d535bc.zip
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
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog7
-rw-r--r--camel/providers/imap4/camel-imap4-store-summary.c16
-rw-r--r--camel/providers/imap4/camel-imap4-store-summary.h2
-rw-r--r--camel/providers/imap4/camel-imap4-store.c14
4 files changed, 32 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index eb942231f3..498dd064de 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -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>
diff --git a/camel/providers/imap4/camel-imap4-store-summary.c b/camel/providers/imap4/camel-imap4-store-summary.c
index ac4e4ad419..7c08469acf 100644
--- a/camel/providers/imap4/camel-imap4-store-summary.c
+++ b/camel/providers/imap4/camel-imap4-store-summary.c
@@ -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) {
diff --git a/camel/providers/imap4/camel-imap4-store-summary.h b/camel/providers/imap4/camel-imap4-store-summary.h
index f9ddc54f19..4a5af80d03 100644
--- a/camel/providers/imap4/camel-imap4-store-summary.h
+++ b/camel/providers/imap4/camel-imap4-store-summary.h
@@ -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
diff --git a/camel/providers/imap4/camel-imap4-store.c b/camel/providers/imap4/camel-imap4-store.c
index 395804849c..ba86ac7dee 100644
--- a/camel/providers/imap4/camel-imap4-store.c
+++ b/camel/providers/imap4/camel-imap4-store.c
@@ -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 ();