From 414303b88e594541d5198a1f3596c9cf1de0bf35 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Mon, 17 Dec 2007 15:58:12 +0000 Subject: [PATCH] Mark message as having been replied to before attempting to put a copy in the sent folder so issues with sent folder don't hinder reply tagging git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@12829 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- src/compose.php | 87 +++++++++++++++++++++++++++---------------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/src/compose.php b/src/compose.php index 29aa1504..619fc708 100644 --- a/src/compose.php +++ b/src/compose.php @@ -1627,48 +1627,13 @@ function deliverMessage($composeMessage, $draft=false) { plain_error_message($msg); } else { unset ($deliver); - $move_to_sent = getPref($data_dir,$username,'move_to_sent'); $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0); - /* 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; - } - - global $passed_id, $mailbox; - if (($fld_sent && $svr_allow_sent && !$lcl_allow_sent) || ($fld_sent && $lcl_allow_sent)) { - if ($action == 'reply' || $action == 'reply_all') { - $save_reply_with_orig=getPref($data_dir,$username,'save_reply_with_orig'); - if ($save_reply_with_orig) { - $sent_folder = $mailbox; - } - } - 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, $reply_id, $reply_ent_id); - sqimap_append_done ($imap_stream, $sent_folder); - unset ($imap_deliver); - } - global $what, $iAccount, $startMessage; + // mark as replied or forwarded if applicable + // + global $what, $iAccount, $startMessage, $passed_id, $mailbox; - $composeMessage->purgeAttachments(); if ($action=='reply' || $action=='reply_all' || $action=='forward' || $action=='forward_as_attachment') { require(SM_PATH . 'functions/mailbox_display.php'); $aMailbox = sqm_api_mailbox_select($imap_stream, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array()); @@ -1713,8 +1678,52 @@ function deliverMessage($composeMessage, $draft=false) { sqsession_register($mailbox_cache,'mailbox_cache'); } - sqimap_logout($imap_stream); } + + + // move to sent folder + // + $move_to_sent = getPref($data_dir,$username,'move_to_sent'); + 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)) { + if ($action == 'reply' || $action == 'reply_all') { + $save_reply_with_orig=getPref($data_dir,$username,'save_reply_with_orig'); + if ($save_reply_with_orig) { + $sent_folder = $mailbox; + } + } + 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, $reply_id, $reply_ent_id); + sqimap_append_done ($imap_stream, $sent_folder); + unset ($imap_deliver); + } + + + // final cleanup + // + $composeMessage->purgeAttachments(); + sqimap_logout($imap_stream); + } return $success; } -- 2.25.1