aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-09-14 07:54:44 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2009-09-14 07:54:44 +0000
commit42b083e0e77ab7b930d0cfa04ab42663e80e79ae (patch)
tree192f951b5ffc84cf0e0f8f1bd10383a1d5a10aaa
parent000486a77e6a305e1466ed23169f4e96e36c00f6 (diff)
update summary cache on move/copy.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2249 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog4
-rw-r--r--libsylph/mh.c46
2 files changed, 19 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index fd46543c..2a5f055d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2009-09-14
+ * libsylph/mh.c: update summary cache on move/copy.
+
+2009-09-14
+
* libsylph/mbox.c: update summary cache when importing from mbox.
2009-09-14
diff --git a/libsylph/mh.c b/libsylph/mh.c
index 46e4b714..5accaf00 100644
--- a/libsylph/mh.c
+++ b/libsylph/mh.c
@@ -420,8 +420,8 @@ static gchar *mh_get_new_msg_filename(FolderItem *dest)
\
if (fp) \
procmsg_write_flags(&newmsginfo, fp); \
- else if (dest->opened) \
- procmsg_add_flags(dest, n, newmsginfo.flags); \
+ else \
+ procmsg_add_mark_queue(dest, n, newmsginfo.flags); \
}
static gint mh_add_msg(Folder *folder, FolderItem *dest, const gchar *file,
@@ -644,7 +644,6 @@ static gint mh_do_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
FolderItem *src;
gchar *srcfile;
gchar *destfile;
- FILE *fp;
GSList *cur;
MsgInfo *msginfo;
@@ -656,11 +655,6 @@ static gint mh_do_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
if (dest->last_num < 0) return -1;
}
- if (dest->opened)
- fp = NULL;
- else if ((fp = procmsg_open_mark_file(dest, DATA_APPEND)) == NULL)
- g_warning(_("Can't open mark file.\n"));
-
for (cur = msglist; cur != NULL; cur = cur->next) {
msginfo = (MsgInfo *)cur->data;
src = msginfo->folder;
@@ -697,10 +691,8 @@ static gint mh_do_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
dest->updated = TRUE;
dest->mtime = 0;
- if (fp) {
- SET_DEST_MSG_FLAGS(fp, dest, dest->last_num,
- msginfo->flags);
- }
+ SET_DEST_MSG_FLAGS(NULL, dest, dest->last_num, msginfo->flags);
+ procmsg_add_cache_queue(dest, dest->last_num, msginfo);
if (MSG_IS_NEW(msginfo->flags)) {
src->new--;
@@ -714,7 +706,10 @@ static gint mh_do_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
MSG_SET_TMP_FLAGS(msginfo->flags, MSG_INVALID);
}
- if (fp) fclose(fp);
+ if (!dest->opened) {
+ procmsg_flush_mark_queue(dest, NULL);
+ procmsg_flush_cache_queue(dest, NULL);
+ }
return dest->last_num;
}
@@ -734,7 +729,6 @@ static gint mh_move_msg(Folder *folder, FolderItem *dest, MsgInfo *msginfo)
static gint mh_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
{
MsgInfo *msginfo;
- GSList *file_list;
gint ret = 0;
gint first;
@@ -742,12 +736,7 @@ static gint mh_move_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
if (folder == msginfo->folder->folder)
return mh_do_move_msgs(folder, dest, msglist);
- file_list = procmsg_get_message_file_list(msglist);
- g_return_val_if_fail(file_list != NULL, -1);
-
- ret = mh_add_msgs(folder, dest, file_list, FALSE, &first);
-
- procmsg_message_file_list_free(file_list);
+ ret = mh_add_msgs_msginfo(folder, dest, msglist, FALSE, &first);
if (ret != -1)
ret = folder_item_remove_msgs(msginfo->folder, msglist);
@@ -771,7 +760,6 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
{
gchar *srcfile;
gchar *destfile;
- FILE *fp;
GSList *cur;
MsgInfo *msginfo;
@@ -783,11 +771,6 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
if (dest->last_num < 0) return -1;
}
- if (dest->opened)
- fp = NULL;
- else if ((fp = procmsg_open_mark_file(dest, DATA_APPEND)) == NULL)
- g_warning(_("Can't open mark file.\n"));
-
for (cur = msglist; cur != NULL; cur = cur->next) {
msginfo = (MsgInfo *)cur->data;
@@ -818,10 +801,8 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
dest->updated = TRUE;
dest->mtime = 0;
- if (fp) {
- SET_DEST_MSG_FLAGS(fp, dest, dest->last_num,
- msginfo->flags);
- }
+ SET_DEST_MSG_FLAGS(NULL, dest, dest->last_num, msginfo->flags);
+ procmsg_add_cache_queue(dest, dest->last_num, msginfo);
if (MSG_IS_NEW(msginfo->flags))
dest->new++;
@@ -829,7 +810,10 @@ static gint mh_copy_msgs(Folder *folder, FolderItem *dest, GSList *msglist)
dest->unread++;
}
- if (fp) fclose(fp);
+ if (!dest->opened) {
+ procmsg_flush_mark_queue(dest, NULL);
+ procmsg_flush_cache_queue(dest, NULL);
+ }
return dest->last_num;
}