diff options
author | Milan Crha <mcrha@redhat.com> | 2011-02-11 16:24:20 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:32 +0800 |
commit | 9fef76c5ca9b46528c2a9497a8595d0e592fcc1b (patch) | |
tree | ab6efe36ec6aa2e34ff41e7ae461fdb7f17e9c3c | |
parent | 5089139eea357c73b592ccf0d9c48f7e66f590c3 (diff) | |
download | gsoc2013-evolution-9fef76c5ca9b46528c2a9497a8595d0e592fcc1b.tar.gz gsoc2013-evolution-9fef76c5ca9b46528c2a9497a8595d0e592fcc1b.tar.zst gsoc2013-evolution-9fef76c5ca9b46528c2a9497a8595d0e592fcc1b.zip |
Bug #636408 - Loss of data on removal of an IMAP folder with an asterisk
-rw-r--r-- | mail/mail-ops.c | 28 |
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); } |