Update the cached flag info in the mailbox cache in case of an reply (set
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 2 Nov 2005 20:45:00 +0000 (20:45 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 2 Nov 2005 20:45:00 +0000 (20:45 +0000)
the reply flag in the cache)

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10232 7612ce4b-ef26-0410-bec9-ea0150e637f0

src/compose.php

index aaf4592e6136fc868dadc606e598511812610ea4..f2b5a4b4f22dd3283f3d7b3a943b3f403147ce42 100644 (file)
@@ -82,6 +82,7 @@ if ( sqgetGlobalVar('startMessage',$startMessage) ) {
     $startMessage = 1;
 }
 
+
 /** POST VARS */
 sqgetGlobalVar('sigappend',             $sigappend,             SQ_POST);
 sqgetGlobalVar('from_htmladdr_search',  $from_htmladdr_search,  SQ_POST);
@@ -96,6 +97,12 @@ if ( sqgetGlobalVar('return', $temp, SQ_POST) ) {
 
 /** GET VARS */
 sqgetGlobalVar('attachedmessages', $attachedmessages, SQ_GET);
+if ( sqgetGlobalVar('account', $temp,  SQ_GET) ) {
+    $iAccount = (int) $temp;
+} else {
+    $iAccount = 0;
+}
+
 
 /** get smaction */
 if ( !sqgetGlobalVar('smaction',$action) )
@@ -1657,12 +1664,29 @@ function deliverMessage($composeMessage, $draft=false) {
             sqimap_append_done ($imap_stream, $sent_folder);
             unset ($imap_deliver);
         }
-        global $passed_id, $mailbox, $action;
+
+        global $passed_id, $mailbox, $action, $what, $iAccount,$startMessage;
+
         ClearAttachments($composeMessage);
         if ($action == 'reply' || $action == 'reply_all') {
-            sqimap_mailbox_select ($imap_stream, $mailbox);
-            sqimap_toggle_flag($imap_stream, array($passed_id), '\\Answered', true, false);
+            $aMailbox = sqm_api_mailbox_select($imap_stream, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array());
+            //sqimap_mailbox_select ($imap_stream, $mailbox);
+            $aUpdatedMsgs = sqimap_toggle_flag($imap_stream, array($passed_id), '\\Answered', true, false);
+             if (isset($aUpdatedMsgs[$iUid]['FLAGS'])) {
+                /**
+                 * Only update the cached headers if the header is
+                 * cached.
+                 */
+                if (isset($aMailbox['MSG_HEADERS'][$iUid])) {
+                    $aMailbox['MSG_HEADERS'][$iUid]['FLAGS'] = $aMsg['FLAGS'];
+                }
+            }
         }
+        /**
+         * Write mailbox with updated seen flag information back to cache.
+         */
+        $mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
+        sqsession_register($mailbox_cache,'mailbox_cache');
         sqimap_logout($imap_stream);
     }
     return $succes;