aboutsummaryrefslogtreecommitdiff
path: root/libsylph/procmsg.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-12-21 10:17:43 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-12-21 10:17:43 +0000
commit99a8803e962701d0b9b43d0421cdc0bb05e8f02a (patch)
tree7ae8246cdd93921068bf453f9cd5c28b79a8bbd9 /libsylph/procmsg.c
parentace1046e570adceb22ce1ee924169b81676517d6 (diff)
reflect flag changes on virtual folders in the real ones.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@850 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/procmsg.c')
-rw-r--r--libsylph/procmsg.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index e93774ba..c2dd50a0 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -536,6 +536,52 @@ void procmsg_write_flags_list(FolderItem *item, GSList *mlist)
item->mark_dirty = FALSE;
}
+static gint cmp_by_item(gconstpointer a, gconstpointer b)
+{
+ const MsgInfo *msginfo1 = a;
+ const MsgInfo *msginfo2 = b;
+
+ if (msginfo1->folder == msginfo2->folder)
+ return msginfo1->msgnum - msginfo2->msgnum;
+
+ return msginfo1->folder - msginfo2->folder;
+}
+
+void procmsg_write_flags_for_multiple_folders(GSList *mlist)
+{
+ GSList *tmp_list, *cur;
+ FolderItem *prev_item = NULL;
+ FILE *fp = NULL;
+
+ if (!mlist)
+ return;
+
+ tmp_list = g_slist_copy(mlist);
+ tmp_list = g_slist_sort(tmp_list, cmp_by_item);
+
+ for (cur = tmp_list; cur != NULL; cur = cur->next) {
+ MsgInfo *msginfo = (MsgInfo *)cur->data;
+ FolderItem *item = msginfo->folder;
+
+ if (prev_item != item) {
+ if (fp)
+ fclose(fp);
+ fp = procmsg_open_mark_file(item, DATA_APPEND);
+ if (!fp) {
+ g_warning("can't open mark file\n");
+ break;
+ }
+ item->updated = TRUE;
+ }
+ procmsg_write_flags(msginfo, fp);
+ prev_item = item;
+ }
+
+ if (fp)
+ fclose(fp);
+ g_slist_free(tmp_list);
+}
+
void procmsg_flush_mark_queue(FolderItem *item, FILE *fp)
{
MsgInfo *flaginfo;