2006-08-24 [colin] 2.4.0cvs81

* src/folder.c
	* src/mh.c
		Fix possible problems with local delivery. Check the folder doesn't
		need scan before setting its mtime when saving cache (which can be
		done long after the folder's been modified by an external process);
		Check that the stored item's mtime didn't change in mh functions.
This commit is contained in:
Colin Leroy 2006-08-24 06:34:54 +00:00
parent ec63824bb1
commit 03e067cde8
5 changed files with 31 additions and 6 deletions

View file

@ -1,3 +1,12 @@
2006-08-24 [colin] 2.4.0cvs81
* src/folder.c
* src/mh.c
Fix possible problems with local delivery. Check the folder doesn't
need scan before setting its mtime when saving cache (which can be
done long after the folder's been modified by an external process);
Check that the stored item's mtime didn't change in mh functions.
2006-08-24 [mones] 2.4.0cvs80
* manual/advanced.xml

View file

@ -1772,3 +1772,4 @@
( cvs diff -u -r 1.94.2.97 -r 1.94.2.98 src/messageview.c; cvs diff -u -r 1.83.2.81 -r 1.83.2.82 src/mimeview.c; cvs diff -u -r 1.20.2.13 -r 1.20.2.14 src/mimeview.h; cvs diff -u -r 1.12.2.12 -r 1.12.2.13 src/plugins/dillo_viewer/dillo_viewer.c; ) > 2.4.0cvs78.patchset
( cvs diff -u -r 1.1.4.22 -r 1.1.4.23 src/gtk/gtksctree.c; ) > 2.4.0cvs79.patchset
( cvs diff -u -r 1.1.2.22 -r 1.1.2.23 manual/advanced.xml; ) > 2.4.0cvs80.patchset
( cvs diff -u -r 1.213.2.107 -r 1.213.2.108 src/folder.c; cvs diff -u -r 1.79.2.37 -r 1.79.2.38 src/mh.c; ) > 2.4.0cvs81.patchset

View file

@ -11,7 +11,7 @@ MINOR_VERSION=4
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=80
EXTRA_VERSION=81
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=

View file

@ -2256,10 +2256,17 @@ void folder_item_write_cache(FolderItem *item)
FolderItemPrefs *prefs;
gint filemode = 0;
gchar *id;
time_t last_mtime = (time_t)0;
gboolean need_scan = FALSE;
if (!item || !item->path || !item->cache)
return;
if (FOLDER_TYPE(item->folder) == F_MH) {
last_mtime = item->mtime;
need_scan = item->folder->klass->scan_required(item->folder, item);
}
id = folder_item_get_identifier(item);
debug_print("Save cache for folder %s\n", id);
g_free(id);
@ -2277,8 +2284,10 @@ void folder_item_write_cache(FolderItem *item)
}
}
if (FOLDER_TYPE(item->folder) == F_MH)
item->mtime = time(NULL);
if (!need_scan && FOLDER_TYPE(item->folder) == F_MH) {
if (item->mtime == last_mtime)
item->mtime = time(NULL);
}
g_free(cache_file);
g_free(mark_file);

View file

@ -467,6 +467,7 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, MsgInfoList *msglist,
gint curnum = 0, total = 0;
gchar *srcpath = NULL;
gboolean full_fetch = FALSE;
time_t last_mtime = (time_t)0;
g_return_val_if_fail(dest != NULL, -1);
g_return_val_if_fail(msglist != NULL, -1);
@ -493,6 +494,7 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, MsgInfoList *msglist,
srcpath = folder_item_get_path(msginfo->folder);
dest_need_scan = mh_scan_required(dest->folder, dest);
last_mtime = dest->mtime;
total = g_slist_length(msglist);
if (total > 100) {
@ -569,7 +571,7 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, MsgInfoList *msglist,
g_free(srcpath);
mh_write_sequences(dest, TRUE);
if (!dest_need_scan)
if (dest->mtime == last_mtime && !dest_need_scan)
dest->mtime = time(NULL);
if (total > 100) {
@ -591,6 +593,7 @@ err_reset_status:
static gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
{
gboolean need_scan = FALSE;
time_t last_mtime = (time_t)0;
gchar *file;
g_return_val_if_fail(item != NULL, -1);
@ -599,6 +602,7 @@ static gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
g_return_val_if_fail(file != NULL, -1);
need_scan = mh_scan_required(folder, item);
last_mtime = item->mtime;
if (g_unlink(file) < 0) {
FILE_OP_ERROR(file, "unlink");
@ -606,7 +610,7 @@ static gint mh_remove_msg(Folder *folder, FolderItem *item, gint num)
return -1;
}
if (!need_scan)
if (item->mtime == last_mtime && !need_scan)
item->mtime = time(NULL);
g_free(file);
@ -618,6 +622,7 @@ static gint mh_remove_msgs(Folder *folder, FolderItem *item,
{
gboolean need_scan = FALSE;
gchar *path, *file;
time_t last_mtime = (time_t)0;
MsgInfoList *cur;
g_return_val_if_fail(item != NULL, -1);
@ -625,6 +630,7 @@ static gint mh_remove_msgs(Folder *folder, FolderItem *item,
path = folder_item_get_path(item);
need_scan = mh_scan_required(folder, item);
last_mtime = item->mtime;
for (cur = msglist; cur; cur = cur->next) {
MsgInfo *msginfo = (MsgInfo *)cur->data;
@ -642,7 +648,7 @@ static gint mh_remove_msgs(Folder *folder, FolderItem *item,
g_free(file);
}
if (!need_scan)
if (item->mtime == last_mtime && !need_scan)
item->mtime = time(NULL);
g_free(path);