aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-03 15:48:46 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-03 15:48:46 +0800
commit1b52a3511ef0949419abcca706c24dacdf415d7d (patch)
treebcad2740ff1804d44bf76ebf88edd3f6d1f36748 /camel
parent57d8da86bea3ffe10aca2ebf71d4fdafcbc92dc7 (diff)
downloadgsoc2013-evolution-1b52a3511ef0949419abcca706c24dacdf415d7d.tar.gz
gsoc2013-evolution-1b52a3511ef0949419abcca706c24dacdf415d7d.tar.zst
gsoc2013-evolution-1b52a3511ef0949419abcca706c24dacdf415d7d.zip
** See bug #57881.
2004-05-03 Not Zed <NotZed@Ximian.com> ** See bug #57881. * camel-vee-folder.c (camel_vee_folder_add_folder): use the folder's change log and frozen count, not our copy. (vee_thaw): dont maintain our frozen count. (vee_freeze): same. (folder_changed_change): if we get changed messages that dont match, make sure they're also propagated as a change too. * camel-private.h: remove the freeze_count from camelveefolderprivate. We already have that in the camel folder private. svn path=/trunk/; revision=25742
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog15
-rw-r--r--camel/camel-folder.c2
-rw-r--r--camel/camel-private.h1
-rw-r--r--camel/camel-vee-folder.c82
4 files changed, 66 insertions, 34 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c4e5fd034f..d43c588e6d 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,18 @@
+2004-05-03 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #57881.
+
+ * camel-vee-folder.c (camel_vee_folder_add_folder): use the
+ folder's change log and frozen count, not our copy.
+ (vee_thaw): dont maintain our frozen count.
+ (vee_freeze): same.
+ (folder_changed_change): if we get changed messages that dont
+ match, make sure they're also propagated as a change too.
+
+ * camel-private.h: remove the freeze_count from
+ camelveefolderprivate. We already have that in the camel folder
+ private.
+
2004-04-30 Priit Laes <amd@tt.ee>
* providers/nntp/camel-nntp-summary.c: Fix typo. #53466.
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 853c49400d..bb81ab88cc 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -43,7 +43,7 @@
#include "camel-vtrash-folder.h"
#include "filter/filter-rule.h"
-#define d(x)
+#define d(x)
#define w(x)
extern int camel_verbose_debug;
diff --git a/camel/camel-private.h b/camel/camel-private.h
index 87aeeff4b7..9d7ae6231e 100644
--- a/camel/camel-private.h
+++ b/camel/camel-private.h
@@ -131,7 +131,6 @@ struct _CamelStoreSummaryPrivate {
struct _CamelVeeFolderPrivate {
GList *folders; /* lock using subfolder_lock before changing/accessing */
GList *folders_changed; /* for list of folders that have changed between updates */
- int freeze_count;
GMutex *summary_lock; /* for locking vfolder summary */
GMutex *subfolder_lock; /* for locking the subfolder list */
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 69e5b0dbcb..6ad9c949a9 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -37,6 +37,7 @@
#include "camel-session.h"
#include "camel-vee-store.h" /* for open flags */
#include "camel-private.h"
+#include "camel-debug.h"
#include "e-util/md5-utils.h"
@@ -45,8 +46,7 @@
#endif
#define d(x)
-extern int camel_verbose_debug;
-#define dd(x) (camel_verbose_debug?(x):0)
+#define dd(x) (camel_debug("vfolder")?(x):0)
#define _PRIVATE(o) (((CamelVeeFolder *)(o))->priv)
@@ -55,8 +55,8 @@ 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);
-static void vee_freeze (CamelFolder *folder);
-static void vee_thaw (CamelFolder *folder);
+static void vee_freeze(CamelFolder *folder);
+static void vee_thaw(CamelFolder *folder);
static CamelMimeMessage *vee_get_message (CamelFolder *folder, const gchar *uid, CamelException *ex);
static void vee_append_message(CamelFolder *folder, CamelMimeMessage *message, const CamelMessageInfo *info, char **appended_uid, CamelException *ex);
@@ -355,16 +355,25 @@ camel_vee_folder_add_folder(CamelVeeFolder *vf, CamelFolder *sub)
camel_object_ref((CamelObject *)sub);
p->folders = g_list_append(p->folders, sub);
+ CAMEL_FOLDER_LOCK(vf, change_lock);
+
/* update the freeze state of 'sub' to match our freeze state */
- for (i = 0; i < p->freeze_count; i++)
- camel_folder_freeze (sub);
+ for (i = 0; i < ((CamelFolder *)vf)->priv->frozen; i++)
+ camel_folder_freeze(sub);
+
+ CAMEL_FOLDER_UNLOCK(vf, change_lock);
}
if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0 && !CAMEL_IS_VEE_FOLDER(sub)) {
camel_object_ref((CamelObject *)sub);
up->folders = g_list_append(up->folders, sub);
+
+ CAMEL_FOLDER_LOCK(folder_unmatched, change_lock);
+
/* update the freeze state of 'sub' to match Unmatched's freeze state */
- for (i = 0; i < up->freeze_count; i++)
- camel_folder_freeze (sub);
+ for (i = 0; i < ((CamelFolder *)folder_unmatched)->priv->frozen; i++)
+ camel_folder_freeze(sub);
+
+ CAMEL_FOLDER_UNLOCK(folder_unmatched, change_lock);
}
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
@@ -408,8 +417,10 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
p->folders = g_list_remove(p->folders, sub);
/* undo the freeze state that we have imposed on this source folder */
- for (i = 0; i < p->freeze_count; i++)
- camel_folder_thaw (sub);
+ CAMEL_FOLDER_LOCK(vf, change_lock);
+ for (i = 0; i < ((CamelFolder *)vf)->priv->frozen; i++)
+ camel_folder_thaw(sub);
+ CAMEL_FOLDER_UNLOCK(vf, change_lock);
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
@@ -422,8 +433,10 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
camel_object_unref((CamelObject *)sub);
/* undo the freeze state that Unmatched has imposed on this source folder */
- for (i = 0; i < up->freeze_count; i++)
- camel_folder_thaw (sub);
+ CAMEL_FOLDER_LOCK(folder_unmatched, change_lock);
+ for (i = 0; i < ((CamelFolder *)folder_unmatched)->priv->frozen; i++)
+ camel_folder_thaw(sub);
+ CAMEL_FOLDER_UNLOCK(folder_unmatched, change_lock);
}
} else if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0) {
if (g_list_find(up->folders, sub) != NULL) {
@@ -431,8 +444,10 @@ camel_vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *sub)
camel_object_unref((CamelObject *)sub);
/* undo the freeze state that Unmatched has imposed on this source folder */
- for (i = 0; i < up->freeze_count; i++)
- camel_folder_thaw (sub);
+ CAMEL_FOLDER_LOCK(folder_unmatched, change_lock);
+ for (i = 0; i < ((CamelFolder *)folder_unmatched)->priv->frozen; i++)
+ camel_folder_thaw(sub);
+ CAMEL_FOLDER_UNLOCK(folder_unmatched, change_lock);
}
if (g_list_find(up->folders, sub) == NULL) {
killun = TRUE;
@@ -1530,10 +1545,13 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
strcpy(vuid+8, uid);
vinfo = (CamelVeeMessageInfo *)camel_folder_summary_uid(folder->summary, vuid);
if (vinfo == NULL) {
- /* A uid we dont have, but now it matches, add it */
if (g_hash_table_lookup(matches_hash, uid)) {
+ /* A uid we dont have, but now it matches, add it */
dd(printf(" adding uid '%s' [newly matched]\n", uid));
folder_changed_add_uid(sub, uid, hash, vf);
+ } else {
+ /* A uid we still don't have, just change it (for unmatched) */
+ folder_changed_change_uid(sub, uid, hash, vf);
}
} else {
if ((vf->flags & CAMEL_STORE_VEE_FOLDER_AUTO) == 0
@@ -1550,6 +1568,10 @@ folder_changed_change(CamelSession *session, CamelSessionThreadMsg *msg)
}
}
g_hash_table_destroy(matches_hash);
+ } else {
+ /* stuff didn't match but it changed - check unmatched folder for changes */
+ for (i=0;i<changed->len;i++)
+ folder_changed_change_uid(sub, changed->pdata[i], hash, vf);
}
if (camel_folder_change_info_changed(folder_unmatched->changes)) {
@@ -1640,49 +1662,45 @@ subfolder_deleted(CamelFolder *f, void *event_data, CamelVeeFolder *vf)
static void
vee_freeze (CamelFolder *folder)
{
- CamelVeeFolder *vfolder = (CamelVeeFolder *) folder;
- struct _CamelVeeFolderPrivate *p = _PRIVATE (vfolder);
+ CamelVeeFolder *vfolder = (CamelVeeFolder *)folder;
+ struct _CamelVeeFolderPrivate *p = _PRIVATE(vfolder);
GList *node;
- CAMEL_VEE_FOLDER_LOCK (vfolder, subfolder_lock);
-
- p->freeze_count++;
+ CAMEL_VEE_FOLDER_LOCK(vfolder, subfolder_lock);
node = p->folders;
while (node) {
CamelFolder *f = node->data;
- camel_folder_freeze (f);
+ camel_folder_freeze(f);
node = node->next;
}
- CAMEL_VEE_FOLDER_UNLOCK (vfolder, subfolder_lock);
+ CAMEL_VEE_FOLDER_UNLOCK(vfolder, subfolder_lock);
/* call parent implementation */
- CAMEL_FOLDER_CLASS (camel_vee_folder_parent)->freeze (folder);
+ CAMEL_FOLDER_CLASS (camel_vee_folder_parent)->freeze(folder);
}
static void
-vee_thaw (CamelFolder *folder)
+vee_thaw(CamelFolder *folder)
{
- CamelVeeFolder *vfolder = (CamelVeeFolder *) folder;
- struct _CamelVeeFolderPrivate *p = _PRIVATE (vfolder);
+ CamelVeeFolder *vfolder = (CamelVeeFolder *)folder;
+ struct _CamelVeeFolderPrivate *p = _PRIVATE(vfolder);
GList *node;
- CAMEL_VEE_FOLDER_LOCK (vfolder, subfolder_lock);
-
- p->freeze_count--;
+ CAMEL_VEE_FOLDER_LOCK(vfolder, subfolder_lock);
node = p->folders;
while (node) {
CamelFolder *f = node->data;
- camel_folder_thaw (f);
+ camel_folder_thaw(f);
node = node->next;
}
- CAMEL_VEE_FOLDER_UNLOCK (vfolder, subfolder_lock);
+ CAMEL_VEE_FOLDER_UNLOCK(vfolder, subfolder_lock);
/* call parent implementation */
- CAMEL_FOLDER_CLASS (camel_vee_folder_parent)->thaw (folder);
+ CAMEL_FOLDER_CLASS (camel_vee_folder_parent)->thaw(folder);
}