aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-ops.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2011-02-11 16:24:20 +0800
committerMilan Crha <mcrha@redhat.com>2011-02-11 16:24:20 +0800
commit38e9c5626e7cc99377c62febe1d07687a084f107 (patch)
tree351efa68c02e05bf96857f0e13f717d669f9803c /mail/mail-ops.c
parenta56bf39d6a0a76b7d941208abb3a4dd07f087115 (diff)
downloadgsoc2013-evolution-38e9c5626e7cc99377c62febe1d07687a084f107.tar.gz
gsoc2013-evolution-38e9c5626e7cc99377c62febe1d07687a084f107.tar.zst
gsoc2013-evolution-38e9c5626e7cc99377c62febe1d07687a084f107.zip
Bug #636408 - Loss of data on removal of an IMAP folder with an asterisk
Diffstat (limited to 'mail/mail-ops.c')
-rw-r--r--mail/mail-ops.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 86cdd88681..920b8bca73 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -1508,7 +1508,7 @@ remove_folder_exec (struct _remove_folder_msg *m,
GCancellable *cancellable,
GError **error)
{
- CamelFolderInfo *fi;
+ CamelFolderInfo *fi, *to_remove, *next = NULL;
CamelStore *parent_store;
const gchar *full_name;
@@ -1526,8 +1526,32 @@ remove_folder_exec (struct _remove_folder_msg *m,
if (fi == NULL)
return;
+ if (fi->next) {
+ /* for cases when the folder info contains more folders on the 0-level,
+ like when full_name contains a wildcard letter, use only folder info
+ for the the exact full_name, to not delete more than requested */
+ for (to_remove = fi; to_remove; to_remove = to_remove->next) {
+ if (g_strcmp0 (to_remove->full_name, full_name) == 0)
+ break;
+ }
+
+ if (!to_remove) {
+ g_warning ("%s: Failed to find '%s' in returned folder info", G_STRFUNC, full_name);
+ camel_store_free_folder_info (parent_store, fi);
+ return;
+ }
+
+ next = to_remove->next;
+ to_remove->next = NULL;
+ } else {
+ to_remove = fi;
+ }
+
m->removed = remove_folder_rec (
- parent_store, fi, cancellable, error);
+ parent_store, to_remove, cancellable, error);
+
+ to_remove->next = next;
+
camel_store_free_folder_info (parent_store, fi);
}