[evolution/wip/gsettings] Bug #636408 - Loss of data on removal of an IMAP folder with an asterisk
- From: Rodrigo Moya <rodrigo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/wip/gsettings] Bug #636408 - Loss of data on removal of an IMAP folder with an asterisk
- Date: Wed, 29 Jun 2011 17:09:07 +0000 (UTC)
commit 9fef76c5ca9b46528c2a9497a8595d0e592fcc1b
Author: Milan Crha <mcrha redhat com>
Date: Fri Feb 11 09:24:20 2011 +0100
Bug #636408 - Loss of data on removal of an IMAP folder with an asterisk
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 86cdd88..920b8bc 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);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]