aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author1 <NotZed@Ximian.com>2001-09-21 13:58:53 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-09-21 13:58:53 +0800
commit0f0f01c1e0b40b513d82ef05082edfc3acf76d9e (patch)
treef69400d5e0c448d594b5f1dedbe638ad800eb94a
parentb2e7adf9b88f9dda003f4e077c5db0dc8cb50d8b (diff)
downloadgsoc2013-evolution-0f0f01c1e0b40b513d82ef05082edfc3acf76d9e.tar.gz
gsoc2013-evolution-0f0f01c1e0b40b513d82ef05082edfc3acf76d9e.tar.zst
gsoc2013-evolution-0f0f01c1e0b40b513d82ef05082edfc3acf76d9e.zip
Force a refresh of vfolders before storing their count. This essentially
2001-09-21 <NotZed@Ximian.com> * camel-vee-store.c (vee_get_folder_info): Force a refresh of vfolders before storing their count. This essentially makes 'get_folderinfo' refresh all vfolders, so that get-mail works as expected. * camel-vee-folder.c (camel_vee_folder_finalise): Clear lists. (folder_changed): If we're not autoupdating the folder, then add this folder to the list of 'changed' folders for this vfolder. (camel_vee_folder_set_expression): Reset the folders_changed list. (camel_vee_folder_remove_folder): Remove the folder from the folders_changed list. (camel_vee_folder_set_folders): If we have a folder already, but its changed, use this opportunity to update it. (vee_sync): Remove any synced folders from the folders_changed list. (vee_refresh_info): Refresh folder, re-run queries on any changed folders. svn path=/trunk/; revision=13045
-rw-r--r--camel/ChangeLog20
-rw-r--r--camel/camel-private.h3
-rw-r--r--camel/camel-vee-folder.c63
-rw-r--r--camel/camel-vee-store.c18
4 files changed, 101 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c624a6fc90..9ce9e3e9dd 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,23 @@
+2001-09-21 <NotZed@Ximian.com>
+
+ * camel-vee-store.c (vee_get_folder_info): Force a refresh of
+ vfolders before storing their count. This essentially makes
+ 'get_folderinfo' refresh all vfolders, so that get-mail works as
+ expected.
+
+ * camel-vee-folder.c (camel_vee_folder_finalise): Clear lists.
+ (folder_changed): If we're not autoupdating the folder, then
+ add this folder to the list of 'changed' folders for this vfolder.
+ (camel_vee_folder_set_expression): Reset the folders_changed list.
+ (camel_vee_folder_remove_folder): Remove the folder from the
+ folders_changed list.
+ (camel_vee_folder_set_folders): If we have a folder already, but
+ its changed, use this opportunity to update it.
+ (vee_sync): Remove any synced folders from the folders_changed
+ list.
+ (vee_refresh_info): Refresh folder, re-run queries on any changed
+ folders.
+
2001-09-20 <NotZed@Ximian.com>
* camel-folder-summary.c (camel_folder_summary_header_load): New
diff --git a/camel/camel-private.h b/camel/camel-private.h
index 34f393b00f..8d65e0ace1 100644
--- a/camel/camel-private.h
+++ b/camel/camel-private.h
@@ -176,7 +176,8 @@ struct _CamelVeeStorePrivate {
#endif
struct _CamelVeeFolderPrivate {
- GList *folders; /* lock using subfolder_lock before changing/accessing */
+ GList *folders; /* lock using subfolder_lock before changing/accessing */
+ GList *folders_changed; /* for list of folders that have changed between updates */
#ifdef ENABLE_THREADS
GMutex *summary_lock; /* for locking vfolder summary */
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 59bbcfcbf2..5cafadc7f5 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -46,6 +46,8 @@
#define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv)
+static void vee_refresh_info(CamelFolder *folder, CamelException *ex);
+
static void vee_sync (CamelFolder *folder, gboolean expunge, CamelException *ex);
static void vee_expunge (CamelFolder *folder, CamelException *ex);
@@ -109,6 +111,7 @@ camel_vee_folder_class_init (CamelVeeFolderClass *klass)
camel_vee_folder_parent = CAMEL_FOLDER_CLASS(camel_type_get_global_classfuncs (camel_folder_get_type ()));
+ folder_class->refresh_info = vee_refresh_info;
folder_class->sync = vee_sync;
folder_class->expunge = vee_expunge;
@@ -176,6 +179,9 @@ camel_vee_folder_finalise (CamelObject *obj)
g_free(vf->expression);
g_free(vf->vname);
+ g_list_free(p->folders);
+ g_list_free(p->folders_changed);
+
camel_folder_change_info_free(vf->changes);
camel_object_unref((CamelObject *)vf->search);
@@ -295,6 +301,9 @@ camel_vee_folder_set_expression(CamelVeeFolder *vf, const char *query)
node = node->next;
}
+ g_list_free(p->folders_changed);
+ p->folders_changed = NULL;
+
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
}
@@ -350,6 +359,9 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
struct _CamelVeeFolderPrivate *p = _PRIVATE(vf), *up = _PRIVATE(folder_unmatched);
CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+
+ p->folders_changed = g_list_remove(p->folders_changed, sub);
+
if (g_list_find(p->folders, sub) == NULL) {
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
return;
@@ -385,13 +397,15 @@ remove_folders(CamelFolder *folder, CamelFolder *foldercopy, CamelVeeFolder *vf)
void
camel_vee_folder_set_folders(CamelVeeFolder *vf, GList *folders)
{
+ struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
GHashTable *remove = g_hash_table_new(NULL, NULL);
GList *l;
CamelFolder *folder;
+ int changed;
/* setup a table of all folders we have currently */
CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
- l = vf->priv->folders;
+ l = p->folders;
while (l) {
g_hash_table_insert(remove, l->data, l->data);
camel_object_ref((CamelObject *)l->data);
@@ -405,6 +419,15 @@ camel_vee_folder_set_folders(CamelVeeFolder *vf, GList *folders)
if ((folder = g_hash_table_lookup(remove, l->data))) {
g_hash_table_remove(remove, folder);
camel_object_unref((CamelObject *)folder);
+
+ /* if this was a changed folder, re-update it while we're here */
+ CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+ changed = g_list_find(p->folders_changed, folder) != NULL;
+ if (changed)
+ p->folders_changed = g_list_remove(p->folders_changed, folder);
+ CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
+ if (changed)
+ vee_folder_build_folder(vf, folder, NULL);
} else {
camel_vee_folder_add_folder(vf, l->data);
}
@@ -449,6 +472,30 @@ camel_vee_folder_hash_folder(CamelFolder *folder, char buffer[8])
}
}
+static void vee_refresh_info(CamelFolder *folder, CamelException *ex)
+{
+ CamelVeeFolder *vf = (CamelVeeFolder *)folder;
+ struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
+ GList *node;
+
+ CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+
+ node = p->folders_changed;
+ while (node) {
+ CamelFolder *f = node->data;
+
+ if (vee_folder_build_folder(vf, f, ex) == -1)
+ break;
+
+ node = node->next;
+ }
+
+ g_list_free(p->folders_changed);
+ p->folders_changed = NULL;
+
+ CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
+}
+
static void
vee_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
{
@@ -472,6 +519,9 @@ vee_sync(CamelFolder *folder, gboolean expunge, CamelException *ex)
node = node->next;
}
+ g_list_free(p->folders_changed);
+ p->folders_changed = NULL;
+
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
}
@@ -964,6 +1014,17 @@ folder_changed(CamelFolder *sub, CamelFolderChangeInfo *changes, CamelVeeFolder
/* if not auto-updating, only propagate changed/removed events, not added items */
if ((vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0) {
+
+ CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
+ /* add this folder to our changed folders list if we have stuff we can't catch easily */
+ /* Unfortuantely if its a change that doesn't affect the match, we're still going to
+ rerun it :( */
+ if (changes->uid_changed->len > 0 || changes->uid_added->len > 0)
+ if (g_list_find(vf->priv->folders_changed, sub) != NULL)
+ vf->priv->folders_changed = g_list_prepend(vf->priv->folders_changed, sub);
+
+ CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
+
CAMEL_VEE_FOLDER_LOCK(vf, summary_lock);
CAMEL_VEE_FOLDER_LOCK(folder_unmatched, summary_lock);
diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c
index dc3febc85d..b8974e5d44 100644
--- a/camel/camel-vee-store.c
+++ b/camel/camel-vee-store.c
@@ -160,6 +160,7 @@ struct _build_info {
const char *top;
guint32 flags;
GPtrArray *infos;
+ GPtrArray *folders;
};
static void
@@ -188,8 +189,10 @@ build_info(char *name, CamelVeeFolder *folder, struct _build_info *data)
((CamelFolder *)folder)->full_name);
info->full_name = g_strdup(((CamelFolder *)folder)->full_name);
info->name = g_strdup(((CamelFolder *)folder)->name);
- info->unread_message_count = camel_folder_get_unread_message_count((CamelFolder *)folder);
+ info->unread_message_count = -1;
g_ptr_array_add(data->infos, info);
+ camel_object_ref((CamelObject *)folder);
+ g_ptr_array_add(data->folders, folder);
}
static CamelFolderInfo *
@@ -197,15 +200,28 @@ vee_get_folder_info(CamelStore *store, const char *top, guint32 flags, CamelExce
{
struct _build_info data;
CamelFolderInfo *info;
+ int i;
/* first, build the info list */
data.top = top;
data.flags = flags;
data.infos = g_ptr_array_new();
+ data.folders = g_ptr_array_new();
CAMEL_STORE_LOCK(store, cache_lock);
g_hash_table_foreach(store->folders, (GHFunc)build_info, &data);
CAMEL_STORE_UNLOCK(store, cache_lock);
+ /* then make sure the unread counts are accurate */
+ for (i=0;i<data.infos->len;i++) {
+ CamelFolderInfo *info = data.infos->pdata[i];
+ CamelFolder *folder = data.folders->pdata[i];
+
+ camel_folder_refresh_info(folder, NULL);
+ info->unread_message_count = camel_folder_get_unread_message_count(folder);
+ camel_object_unref((CamelObject *)folder);
+ }
+ g_ptr_array_free(data.folders, TRUE);
+
/* and always add UNMATCHED, if scanning from top/etc */
if (top == NULL || top[0] == 0 || strncmp(top, CAMEL_UNMATCHED_NAME, strlen(CAMEL_UNMATCHED_NAME)) == 0) {
info = g_malloc0(sizeof(*info));
>Update with the new PORTNAME/PORTVERSION variablescpiazza2000-04-101-3/+3 * The wildcard removal of config files in post-install was removingpaul2000-04-061-2/+2 * Upgrade to mod_ssl 2.6.2rse2000-03-022-3/+3 * Upgrade to mod_ssl 2.6.1rse2000-02-292-3/+3 * Upgrade to Apache 1.3.12 + mod_ssl 2.6.0rse2000-02-273-5/+8 * Fix build error: RSA_BASE='SYSTEM' is not appropriate for recent openssldirk2000-02-261-1/+0 * Fix Y2K linkrse2000-02-241-1/+1 * This port requires RSAkris2000-02-221-1/+1 * Oops.kris2000-02-121-0/+36 * USE_OPENSSLkris2000-02-121-7/+7 * Upgrade to Apache 1.3.11 + mod_ssl 2.5.0rse2000-01-235-17/+32 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.10rse2000-01-092-3/+3 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.9rse1999-11-252-3/+3 * Change dependencies from static to shared openssl libraries,dirk1999-11-081-2/+2 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.8rse1999-11-052-3/+3 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.7rse1999-11-022-3/+3 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.6rse1999-10-223-4/+4 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.5rse1999-10-012-3/+3 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.4rse1999-09-282-3/+3 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.3rse1999-09-272-3/+3 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.2rse1999-09-062-3/+3 * Take over fixes from Dirk's apache13-php3 port.rse1999-08-312-1/+11 * $Id$ -> $FreeBSD$peter1999-08-311-1/+1 * Upgrade to Apache 1.3.9 + mod_ssl 2.4.1rse1999-08-312-5/+5 * chmod -> ${CHMOD}mharo1999-08-231-2/+2 * It's double-feature time:rse1999-08-205-65/+54 * Update for mod_ssl 2.3.1rse1999-08-192-4/+4 * mod_ssl 2.3.9 -> 2.3.10rse1999-07-282-4/+4 * mod_ssl 2.3.8 -> 2.3.9rse1999-07-262-4/+4 * Shit happens: mod_ssl 2.3.8 ;)rse1999-07-252-4/+4 * Upgrade to Apache 1.3.6 + mod_ssl 2.3.7rse1999-07-252-4/+4 * Upgrade to mod_ssl 2.3.6rse1999-07-152-5/+5 * Change PKGNAMEs to conform to guidelines.asami1999-06-281-2/+2 * #4/4 enforcing Caps, no periodhoek1999-06-271-1/+1 * Upgrade to Apache 1.3.6 + mod_ssl 2.3.5rse1999-06-242-4/+4 * Daily version bump for mod_ssl ;)rse1999-06-092-4/+4 * Upgrade to Apache 1.3.6 + mod_ssl 2.3.2rse1999-06-083-6/+9 * Upgrade to Apache 1.3.6 + mod_ssl 2.3.1dirk1999-06-024-13/+32 * Update MASTER_SITES for new modssl.org locations.rse1999-05-011-3/+3 * Upgrade to Apache 1.3.6 + mod_ssl 2.2.8rse1999-04-122-4/+4 * Cleanup Perl dependencies.rse1999-04-121-3/+6 * Upgrade to Apache 1.3.6 + mod_ssl 2.2.7rse1999-03-292-4/+4 * ${PREFIX}/bin/ssleay -> ${PREFIX}/bin/openssl due to openssl upgrade.dirk1999-03-261-3/+3 * - Upgraded to Apache 1.3.6 + mod_ssl 2.2.6rse1999-03-246-476/+415 * Upgrade to Apache 1.3.4 + mod_ssl 2.2.5rse1999-03-182-7/+8 * Fix missing "\"sbillf1999-03-141-2/+2 * Add the Apache mirror sites. For ports with 'mods' attached to them, the MAST...billf1999-03-141-2/+17 * Upgrade to Apache 1.3.4 + mod_ssl 2.2.4rse1999-03-054-12/+13 * Upgrade to Apache 1.3.4 + mod_ssl 2.2.3rse1999-02-222-4/+5 * Upgrade to Apache 1.3.4 + mod_ssl 2.2.2rse1999-02-052-4/+4 * Upgrade to Apache 1.3.4 + mod_ssl 2.2.1rse1999-02-044-5/+8 * Upgrade to Apache 1.3.4 + mod_ssl 2.2.0rse1999-01-283-6/+8 * Update to Apache 1.3.4 + mod_ssl 2.1.8rse1999-01-252-4/+4 * - Upgrade to Apache 1.3.4rse1999-01-136-65/+98 * Change dependencies from SSLeay to openssl, the successor of SSLeay.dirk1999-01-101-5/+5 * Upgrade to Apache 1.3.3 + mod_ssl 2.1.6rse1999-01-072-4/+4 * Upgrade to Apache 1.3.3 + mod_ssl 2.1.5rse1999-01-032-4/+4 * Upgrade to Apache 1.3.3 + mod_ssl 2.1.4rse1998-12-252-4/+4 * Upgrade to Apache 1.3.3 + mod_ssl 2.1.3rse1998-12-062-4/+4 * Upgrade to Apache 1.3.3 + mod_ssl 2.1.2rse1998-12-035-23/+119 * Upgrade to Apache 1.3.3 + mod_ssl 2.0.15rse1998-11-073-13/+21 * Upgrade to Apache 1.3.2 + mod_ssl 2.0.12rse1998-10-023-5/+5 * Upgrade to Apache 1.3.2 + mod_ssl 2.0.11rse1998-09-233-7/+7 * Completely overhauled Apache+mod_ssl port:rse1998-09-173-29/+51 * Upgrade to Apache 1.3.1 + mod_ssl 2.0.9rse1998-09-152-3/+3 * Upgrade to Apache 1.3.1 + mod_ssl 2.0.8rse1998-09-132-3/+3 * Upgrade SSL-aware Apache to: Apache 1.3.1 + mod_ssl 2.0.7rse1998-09-093-13/+33 * Upgrade to Apache 1.3.1 + mod_ssl 2.0.6rse1998-08-302-3/+3 * Import of a new SSL-aware Apache 1.3, achieved by patching uprse1998-08-28