aboutsummaryrefslogtreecommitdiff
path: root/libsylph/procmsg.c
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-01-23 10:08:45 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-01-23 10:08:45 +0000
commit105eb9bfb18a3324ebbda41cf2bd8b0695748f91 (patch)
treedacebe6c35330a911378ab5b34fc7f4c8335187a /libsylph/procmsg.c
parent77288037d78abd6b3a9be9cdb1e831a1d16de49b (diff)
implemented clearing of IMAP4 message caches on exit.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@919 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph/procmsg.c')
-rw-r--r--libsylph/procmsg.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/libsylph/procmsg.c b/libsylph/procmsg.c
index 0adb215b..77b881bc 100644
--- a/libsylph/procmsg.c
+++ b/libsylph/procmsg.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1212,6 +1212,40 @@ void procmsg_empty_all_trash(void)
}
}
+static gboolean remove_all_cached_messages_func(GNode *node, gpointer data)
+{
+ FolderItem *item;
+ gchar *dir;
+
+ g_return_val_if_fail(node->data != NULL, FALSE);
+
+ item = FOLDER_ITEM(node->data);
+ if (!item->path)
+ return FALSE;
+
+ dir = folder_item_get_path(item);
+ if (is_dir_exist(dir)) {
+ debug_print("removing all cached messages in '%s' ...\n",
+ item->path);
+ remove_all_numbered_files(dir);
+ }
+ g_free(dir);
+
+ return FALSE;
+}
+
+void procmsg_remove_all_cached_messages(Folder *folder)
+{
+ g_return_if_fail(folder != NULL);
+ g_return_if_fail(FOLDER_IS_REMOTE(folder));
+
+ debug_print("Removing all caches in the mailbox '%s' ...\n",
+ folder->name);
+
+ g_node_traverse(folder->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
+ remove_all_cached_messages_func, NULL);
+}
+
gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file)
{
gint num;