File bnc-262790-move-folder-hierarchy.diff of Package evolution

Index: mail/em-folder-utils.c
===================================================================
--- a/mail/em-folder-utils.c	(revision 37529)
+++ a/mail/em-folder-utils.c	(working copy)
@@ -136,8 +136,13 @@ emft_copy_folders__exec (struct _EMCopyF
 			CamelFolder *fromfolder, *tofolder;
 			GPtrArray *uids;
 			int deleted = 0;
+			gboolean is_exchange = 0, rename_handling = (m->tostore == m->fromstore) && m->delete;
 
-			if (info->child)
+			/* Set is_exchange if it is a move operation and if it is for the Exchange hierarchy */
+			if (rename_handling && !g_ascii_strncasecmp(info->uri, "exchange://", 11))
+				is_exchange = 1;
+
+			if (info->child && !is_exchange)
 				pending = g_list_append (pending, info->child);
 
 			if (m->tobase[0])
@@ -151,7 +156,7 @@ emft_copy_folders__exec (struct _EMCopyF
 			/* Not sure if this is really the 'right thing', e.g. for spool stores, but it makes the ui work */
 			if ((info->flags & CAMEL_FOLDER_NOSELECT) == 0) {
 				d(printf ("this folder is selectable\n"));
-				if (m->tostore == m->fromstore && m->delete) {
+				if (rename_handling) {
 					camel_store_rename_folder (m->fromstore, info->full_name, toname->str, &m->base.ex);
 					if (camel_exception_is_set (&m->base.ex))
 						goto exception;
openSUSE Build Service is sponsored by