Support for $Forwarded IMAP keyword, when it is supported or when arbitrary keywords...
authoravel <avel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 9 Oct 2006 14:00:34 +0000 (14:00 +0000)
committeravel <avel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 9 Oct 2006 14:00:34 +0000 (14:00 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11876 7612ce4b-ef26-0410-bec9-ea0150e637f0

ChangeLog
src/compose.php

index f0de65e..ef2c11b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,9 +4,12 @@
 
 Version 1.5.2 - CVS
 -------------------
 
 Version 1.5.2 - CVS
 -------------------
+  - Now uses the $Forwarded IMAP keyword for forwarded messages, when it is
+    enabled or when arbitrary keywords ("PERMANENT FLAGS \*") are permitted.
+    RFC 4550, paragraph 2.8.
   - Added support for authorization identifier in IMAP backend, for SASL
     authentication mechanisms PLAIN and DIGEST-MD5. This can be set upon login
   - Added support for authorization identifier in IMAP backend, for SASL
     authentication mechanisms PLAIN and DIGEST-MD5. This can be set upon login
-       by use of an external plugin.
+    by use of an external plugin.
   - Fix warning about array required in array_keys for display options when no
     fontset is defined.
   - Added "bad plugin" blacklist in configtest.php.
   - Fix warning about array required in array_keys for display options when no
     fontset is defined.
   - Added "bad plugin" blacklist in configtest.php.
index a76e7e6..8bc437c 100644 (file)
@@ -1636,29 +1636,52 @@ function deliverMessage($composeMessage, $draft=false) {
         global $passed_id, $mailbox, $action, $what, $iAccount,$startMessage;
 
         $composeMessage->purgeAttachments();
         global $passed_id, $mailbox, $action, $what, $iAccount,$startMessage;
 
         $composeMessage->purgeAttachments();
-        if ($action == 'reply' || $action == 'reply_all') {
+        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());
             require(SM_PATH . 'functions/mailbox_display.php');
             $aMailbox = sqm_api_mailbox_select($imap_stream, $iAccount, $mailbox,array('setindex' => $what, 'offset' => $startMessage),array());
-            // 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'];
+            switch($action) {
+            case 'reply':
+            case 'reply_all':
+                // 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'];
+                        }
+                    }
+                }
+                break;
+            case 'forward':
+            case 'forward_as_attachment':
+                // check if we are allowed to set the $Forwarded flag (RFC 4550 paragraph 2.8)
+                if (in_array('$forwarded',$aMailbox['PERMANENTFLAGS'], true) || 
+                    in_array('\\*',$aMailbox['PERMANENTFLAGS'])) {
+
+                    $aUpdatedMsgs = sqimap_toggle_flag($imap_stream, array($passed_id), '$Forwarded', true, false);
+                    if (isset($aUpdatedMsgs[$passed_id]['FLAGS'])) {
+                        if (isset($aMailbox['MSG_HEADERS'][$passed_id])) {
+                            $aMailbox['MSG_HEADERS'][$passed_id]['FLAGS'] = $aMsg['FLAGS'];
+                        }
                     }
                 }
                     }
                 }
+                break;
             }
             }
+
             /**
              * Write mailbox with updated seen flag information back to cache.
              */
             /**
              * Write mailbox with updated seen flag information back to cache.
              */
-            $mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
-            sqsession_register($mailbox_cache,'mailbox_cache');
+            if(isset($aUpdatedMsgs[$passed_id])) {
+                $mailbox_cache[$iAccount.'_'.$aMailbox['NAME']] = $aMailbox;
+                sqsession_register($mailbox_cache,'mailbox_cache');
+            }
+
+            sqimap_logout($imap_stream);
         }
         }
-        sqimap_logout($imap_stream);
     }
     return $success;
 }
     }
     return $success;
 }