Port 1.4 sent_folder fixes to devel
authorjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 29 Jun 2003 21:22:30 +0000 (21:22 +0000)
committerjangliss <jangliss@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 29 Jun 2003 21:22:30 +0000 (21:22 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5176 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/compose.php

index 1cd22ce..e1b2d57 100644 (file)
@@ -1504,13 +1504,33 @@ function deliverMessage($composeMessage, $draft=false) {
         unset ($deliver);
         $move_to_sent = getPref($data_dir,$username,'move_to_sent');
         $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
-        if (sqimap_mailbox_exists ($imap_stream, $sent_folder) && ((isset($move_to_sent) && $move_to_sent) ||
-           (isset($default_move_to_sent) && $default_move_to_sent))) {
-                sqimap_append ($imap_stream, $sent_folder, $length);
+
+        /* Move to sent code */
+        if (isset($default_move_to_sent) && ($default_move_to_sent != 0)) {
+            $svr_allow_sent = true;
+        } else {
+            $svr_allow_sent = false;
+        }
+
+        if (isset($sent_folder) && (($sent_folder != '') || ($sent_folder != 'none')) 
+           && sqimap_mailbox_exists( $imap_stream, $sent_folder)) {
+            $fld_sent = true;
+        } else {
+            $fld_sent = false;
+        }
+
+        if ((isset($move_to_sent) && ($move_to_sent != 0)) || (!isset($move_to_sent))) {
+            $lcl_allow_sent = true;
+        } else {
+            $lcl_allow_sent = false;
+        }
+
+        if (($fld_sent && $svr_allow_sent && !$lcl_allow_sent) || ($fld_sent && $lcl_allow_sent)) {
+            sqimap_append ($imap_stream, $sent_folder, $length);
             require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
             $imap_deliver = new Deliver_IMAP();
             $imap_deliver->mail($composeMessage, $imap_stream);
-                sqimap_append_done ($imap_stream, $sent_folder);
+            sqimap_append_done ($imap_stream, $sent_folder);
             unset ($imap_deliver);
         }
         global $passed_id, $mailbox, $action;