Fix for #550557
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 11 Feb 2006 11:33:46 +0000 (11:33 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 11 Feb 2006 11:33:46 +0000 (11:33 +0000)
Do not try to set the \Answered flag if PERMANENTFLAGS doesn't advertise
\Answered.
PERMANENTFLAGS contain the flags that can be toggled in the selected mailbox

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

src/compose.php

index c2ed4e2254a47dc927ce1412610b63d5b345b584..e0ef1378ad27fb54ff52cc83003e67566957299a 100644 (file)
@@ -1695,15 +1695,17 @@ function deliverMessage($composeMessage, $draft=false) {
         $composeMessage->purgeAttachments();
         if ($action == 'reply' || $action == 'reply_all') {
             $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[$passed_id]['FLAGS'])) {
-                /**
-                 * Only update the cached headers if the header is
-                 * cached.
-                 */
-                if (isset($aMailbox['MSG_HEADERS'][$passed_id])) {
-                    $aMailbox['MSG_HEADERS'][$passed_id]['FLAGS'] = $aMsg['FLAGS'];
+            // check if we are allowed to set the \\Answered flag
+            if (in_array('\\answered',$aMailbox['PERMANENTFLAGS'], true)) {
+                $aUpdatedMsgs = sqimap_toggle_flag($imap_stream, array($passed_id), '\\Answered', true, false);
+                if (isset($aUpdatedMsgs[$passed_id]['FLAGS'])) {
+                    /**
+                     * Only update the cached headers if the header is
+                     * cached.
+                     */
+                    if (isset($aMailbox['MSG_HEADERS'][$passed_id])) {
+                        $aMailbox['MSG_HEADERS'][$passed_id]['FLAGS'] = $aMsg['FLAGS'];
+                    }
                 }
             }
             /**