We're living in 2004 now... perl is your friend for these kinds of things :)
[squirrelmail.git] / functions / imap_messages.php
index 6aaaf8d4774833b1c97b1ce0100de70e7eba3165..cbfd233b512e341a48762b4c524cfe85cf4ce4dd 100755 (executable)
@@ -3,7 +3,7 @@
 /**
  * imap_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.
  *
  * This implements functions that manipulate messages
@@ -63,10 +63,11 @@ function sqimap_msgs_list_move ($imap_stream, $id, $mailbox) {
  * @param string $mailbox Mailbox messages are being deleted from
  * @return void
  */
-function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
+function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox, $bypass_trash=false) {
     global $move_to_trash, $trash_folder, $auto_expunge, $uid_support;
 
-    if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
+    if (($move_to_trash == true) && ($bypass_trash != true) &&
+        (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
         sqimap_messages_copy ($imap_stream, $start, $end, $trash_folder);
     }
     sqimap_messages_flag ($imap_stream, $start, $end, "Deleted", true);
@@ -75,7 +76,8 @@ function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
 function sqimap_msgs_list_delete ($imap_stream, $mailbox, $id, $bypass_trash=false) {
     global $move_to_trash, $trash_folder, $uid_support;
     $msgs_id = sqimap_message_list_squisher($id);
-    if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder)) && ($bypass_trash != true)) {
+    if (($move_to_trash == true) && ($bypass_trash != true) &&
+        (sqimap_mailbox_exists($imap_stream, $trash_folder) &&  ($mailbox != $trash_folder)) ) {
         $read = sqimap_run_command ($imap_stream, "COPY $msgs_id " . sqimap_encode_mailbox_name($trash_folder), true, $response, $message, $uid_support);
     }
     $read = sqimap_run_command ($imap_stream, "STORE $msgs_id +FLAGS (\\Deleted)", true, $response, $message, $uid_support);