diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-10-02 06:33:24 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-10-02 06:33:24 +0800 |
commit | c634d2826e6f7726dc59fdd134ac17ac23f5dc6e (patch) | |
tree | 9db854b058f6a82f221aaff379583c46f891fdff /camel/providers/imap | |
parent | 2d249c55ca4b99a536f6b0d92bef84419a3925c2 (diff) | |
download | gsoc2013-evolution-c634d2826e6f7726dc59fdd134ac17ac23f5dc6e.tar.gz gsoc2013-evolution-c634d2826e6f7726dc59fdd134ac17ac23f5dc6e.tar.zst gsoc2013-evolution-c634d2826e6f7726dc59fdd134ac17ac23f5dc6e.zip |
Remove any cached messages that belonged to the deleted folder.
2001-10-01 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-store.c (delete_folder): Remove any
cached messages that belonged to the deleted folder.
(subscribe_folder): Don't ever let the info->name be NULL and
don't use the stupid concat kludge to generate the URL, just use a
CamelURL to do it. This way we don't risk breaking stuff by having
a url like imap://fejj@imap//folder
svn path=/trunk/; revision=13288
Diffstat (limited to 'camel/providers/imap')
-rw-r--r-- | camel/providers/imap/camel-imap-store.c | 62 |
1 files changed, 56 insertions, 6 deletions
diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index 6f058a7c60..1ab13d9a47 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -40,6 +40,8 @@ #include "camel-imap-folder.h" #include "camel-imap-utils.h" #include "camel-imap-command.h" +#include "camel-imap-summary.h" +#include "camel-imap-message-cache.h" #include "camel-disco-diary.h" #include "camel-file-utils.h" #include "camel-folder.h" @@ -1034,6 +1036,45 @@ delete_folder (CamelStore *store, const char *folder_name, CamelException *ex) folder_name); if (response) camel_imap_response_free (imap_store, response); + + if (!camel_exception_is_set (ex)) { + CamelFolderSummary *summary; + CamelImapMessageCache *cache; + char *summary_file; + char *journal_file; + char *folder_dir; + + folder_dir = e_path_to_physical (imap_store->storage_path, folder_name); + if (access (folder_dir, F_OK) != 0) { + g_free (folder_dir); + return; + } + + summary_file = g_strdup_printf ("%s/summary", folder_dir); + summary = camel_imap_summary_new (summary_file); + if (!summary) { + g_free (summary_file); + g_free (folder_dir); + return; + } + + cache = camel_imap_message_cache_new (folder_dir, summary, ex); + if (cache) + camel_imap_message_cache_clear (cache); + + camel_object_unref (CAMEL_OBJECT (cache)); + camel_object_unref (CAMEL_OBJECT (summary)); + + unlink (summary_file); + g_free (summary_file); + + journal_file = g_strdup_printf ("%s/summary", folder_dir); + unlink (journal_file); + g_free (journal_file); + + rmdir (folder_dir); + g_free (folder_dir); + } } static CamelFolderInfo * @@ -1529,33 +1570,42 @@ subscribe_folder (CamelStore *store, const char *folder_name, CamelImapStore *imap_store = CAMEL_IMAP_STORE (store); CamelImapResponse *response; CamelFolderInfo *fi; - char *name; - + const char *name; + CamelURL *url; + if (!camel_disco_store_check_online (CAMEL_DISCO_STORE (store), ex)) return; if (!camel_remote_store_connected (CAMEL_REMOTE_STORE (store), ex)) return; - + response = camel_imap_command (imap_store, NULL, ex, "SUBSCRIBE %F", folder_name); if (!response) return; camel_imap_response_free (imap_store, response); - + g_hash_table_insert (imap_store->subscribed_folders, g_strdup (folder_name), GUINT_TO_POINTER (1)); - + name = strrchr (folder_name, imap_store->dir_sep); if (name) name++; + else + name = folder_name; + + url = camel_url_new (imap_store->base_url, NULL); + g_free (url->path); + url->path = g_strdup_printf ("/%s", folder_name); fi = g_new0 (CamelFolderInfo, 1); fi->full_name = g_strdup (folder_name); fi->name = g_strdup (name); - fi->url = g_strdup_printf ("%s/%s", imap_store->base_url, folder_name); + fi->url = camel_url_to_string (url, CAMEL_URL_HIDE_ALL); fi->unread_message_count = -1; camel_folder_info_build_path (fi, imap_store->dir_sep); + camel_url_free (url); + camel_object_trigger_event (CAMEL_OBJECT (store), "folder_created", fi); camel_folder_info_free (fi); } |