DMN now remembers the last target mailbox to match up with the rest of SM
[squirrelmail.git] / plugins / delete_move_next / setup.php
index 67083dab7f9f8078ab72f95a9ec7f49592f2dd9a..da52c45650d30c607ae2dfbda9a434336e42f416 100644 (file)
@@ -218,8 +218,13 @@ function delete_move_next_read($currloc) {
 }
 
 function get_move_target_list() {
-    global $imapConnection;
-    echo sqimap_mailbox_option_list($imapConnection);
+    global $imapConnection, $lastTargetMailbox;
+    if (isset($lastTargetMailbox) && !empty($lastTargetMailbox)) {
+        echo sqimap_mailbox_option_list($imapConnection, array(strtolower($lastTargetMailbox)));
+    }
+    else {
+        echo sqimap_mailbox_option_list($imapConnection);
+    }
 }
 
 function delete_move_next_moveNextForm($next) {
@@ -292,7 +297,7 @@ function delete_move_next_delete() {
 }
 
 function delete_move_next_move() {
-    global $imapConnection, $mailbox, $auto_expunge;
+    global $imapConnection, $mailbox, $auto_expunge, $lastTargetMailbox;
 
     if ( !check_php_version(4,1) ) {
         global $_POST;
@@ -309,6 +314,11 @@ function delete_move_next_move() {
         delete_move_expunge_from_all($move_id);
         // sqimap_mailbox_expunge($imapConnection, $mailbox, true);
     }
+
+    if ($targetMailbox != $lastTargetMailbox) {
+        $lastTargetMailbox = $targetMailbox;
+        sqsession_register('lastTargetMailbox' , $lastTargetMailbox);
+    }
 }
 
 function delete_move_next_display_inside() {