Added Flag/Unflag buttons. I have been up for 2 days straight. Please check for...
[squirrelmail.git] / src / move_messages.php
index 51af2ce4d2efe10d4d8ac8d5d632a4cf79e2f472..008bf1eaaff14c85ded0daa42b6a8638a7889af7 100644 (file)
@@ -3,15 +3,16 @@
 /**
  * move_messages.php
  *
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Enables message moving between folders on the IMAP server.
  *
  * $Id$
+ * @package squirrelmail
  */
 
-/* Path for SquirrelMail required files. */
+/** Path for SquirrelMail required files. */
 define('SM_PATH','../');
 
 /* SquirrelMail required files. */
@@ -77,7 +78,7 @@ function attachSelectedMessages($msg, $imapConnection) {
             $fp = fopen( $full_localfilename, 'wb');
             fwrite ($fp, $body);
             fclose($fp);
-            $composeMessage->initAttachment('message/rfc822',$subject.'.eml',
+            $composeMessage->initAttachment('message/rfc822',$subject.'.msg',
                  $full_localfilename);
         }
     }
@@ -114,6 +115,7 @@ sqgetGlobalVar('markRead',        $markRead,        SQ_POST);
 sqgetGlobalVar('markUnread',      $markUnread,      SQ_POST);
 sqgetGlobalVar('attache',         $attache,         SQ_POST);
 sqgetGlobalVar('location',        $location,        SQ_POST);
+sqgetGlobalVar('bypass_trash',    $bypass_trash,    SQ_POST);
 
 /* end of get globals */
 
@@ -171,14 +173,17 @@ if(isset($expungeButton)) {
     if (count($id)) {
         $cnt = count($id);
         if (!isset($attache)) {
-            $button_action = concat_hook_function('move_messages_button_action');
             if (isset($markRead)) {
                 sqimap_toggle_flag($imapConnection, $id, '\\Seen',true,true);
             } else if (isset($markUnread)) {
                 sqimap_toggle_flag($imapConnection, $id, '\\Seen',false,true);
+            } else if (isset($markFlagged)) {
+                sqimap_toggle_flag($imapConnection, $id, '\\Flagged', true, true);
+            } else if (isset($markUnflagged)) {
+                sqimap_toggle_flag($imapConnection, $id, '\\Flagged', false, true);
             } else  {
-                if (!$button_action) {
-                    sqimap_msgs_list_delete($imapConnection, $mailbox, $id);
+                if (!boolean_hook_function('move_messages_button_action', NULL, 1)) {
+                    sqimap_msgs_list_delete($imapConnection, $mailbox, $id,$bypass_trash);
                     if ($auto_expunge) {
                         $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true);
                     }
@@ -209,7 +214,7 @@ if(isset($expungeButton)) {
 } else {    // Move messages
 
     if (count($id)) {
-        sqimap_msgs_list_copy($imapConnection,$id,$targetMailbox);
+        sqimap_msgs_list_move($imapConnection,$id,$targetMailbox);
         if ($auto_expunge) {
             $cnt = sqimap_mailbox_expunge($imapConnection, $mailbox, true);
         } else {