Index: /sandbox/2.4.1-1/expressoMail1_2/inc/class.imap_functions.inc.php
===================================================================
--- /sandbox/2.4.1-1/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6366)
+++ /sandbox/2.4.1-1/expressoMail1_2/inc/class.imap_functions.inc.php	(revision 6427)
@@ -5349,5 +5349,13 @@
 				$message_number = explode(',', $message_number);
 				$this->mbox = $this->open_mbox($folder);
-				foreach ($message_number as $k => $m) {						
+				foreach ($message_number as $k => $m) {
+ob_start();
+print_r("folder \n");
+print_r($folder);
+print_r("message number \n");
+print_r($m);
+
+$output = ob_get_clean();
+file_put_contents( "/tmp/marci.log", $output , FILE_APPEND);				
 						imap_clearflag_full($this->mbox, $m, '$FilteredMessage', ST_UID);
 					}
@@ -5369,4 +5377,6 @@
 			}
 		}
+		
+		return array('status' => "success"); 
 	}
 
Index: /sandbox/2.4.1-1/expressoMail1_2/js/main.js
===================================================================
--- /sandbox/2.4.1-1/expressoMail1_2/js/main.js	(revision 6366)
+++ /sandbox/2.4.1-1/expressoMail1_2/js/main.js	(revision 6427)
@@ -1092,11 +1092,4 @@
 			Element('tot_m').innerHTML = n_total_msg;
 		}
-		// remove a flag $FilteredMessage da mensagem ao ser movida
-		$.each(fromRules, function(index, value) {
-			if(value == folder){
-				cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+new_folder+"&msg_number="+msgs_number, function(){}); 
-				return false;
-			}
-		});
 		refresh();
 	}
@@ -1133,9 +1126,20 @@
 	refresh();
 	if (parseInt(msgs_number) > 0 || msgs_number.length > 0){
-		if(!not_opem_previus){
-			cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message, handler_move_msgs);
-		}else{
-			cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+false, handler_move_msgs);
-        }
+			// remove a flag $FilteredMessage da mensagem ao ser movida
+		var handler_removeFlag = function(data){
+			if(!not_opem_previus){
+				cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+preferences.delete_and_show_previous_message, handler_move_msgs);
+			}else{
+				cExecute ("$this.imap_functions.move_messages&folder="+folder+"&msgs_number="+msgs_number+"&border_ID="+border_ID+"&sort_box_type="+sort_box_type+"&search_box_type="+search_box_type+"&sort_box_reverse="+sort_box_reverse+"&reuse_border="+border_ID+"&new_folder="+new_folder+"&new_folder_name="+new_folder_name+"&get_previous_msg="+false, handler_move_msgs);
+			}
+		}
+		$.each(fromRules, function(index, value) {
+			if(value == folder){
+				cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+folder+"&msg_number="+msgs_number, handler_removeFlag); 
+				return false;
+			}
+		});
+		
+		
 	}else
 		write_msg(get_lang('No selected message.'));
Index: /sandbox/2.4.1-1/expressoMail1_2/js/messages_controller.js
===================================================================
--- /sandbox/2.4.1-1/expressoMail1_2/js/messages_controller.js	(revision 6364)
+++ /sandbox/2.4.1-1/expressoMail1_2/js/messages_controller.js	(revision 6427)
@@ -47,12 +47,4 @@
 		if (msgs_number == 'selected')
 			msgs_number = get_selected_messages();
-		
-		// remove a flag $FilteredMessage da mensagem ao excluí-la
-		$.each(fromRules, function(index, value) {
-			if(value == folder){
-				cExecute ("$this.imap_functions.removeFlagMessagesFilter&folder="+folder+"&msg_number="+msgs_number, function(){}); 	
-				return false;
-			}
-		});
 		
 		if(currentTab != 0 && currentTab.indexOf("search_")  >= 0){
