[prev in list] [next in list] [prev in thread] [next in thread] 

List:       squirrelmail-cvs
Subject:    [SM-CVS] SF.net SVN: squirrelmail: [12413] trunk/squirrelmail
From:       pdontthink () users ! sourceforge ! net
Date:       2007-05-18 10:41:02
Message-ID: E1HoztO-0002w8-GO () sc8-pr-svn2 ! sourceforge ! net
[Download RAW message or body]

Revision: 12413
          http://squirrelmail.svn.sourceforge.net/squirrelmail/?rev=12413&view=rev
Author:   pdontthink
Date:     2007-05-18 03:41:02 -0700 (Fri, 18 May 2007)

Log Message:
-----------
Correctly update cached message flags in ALL places when they are changed by the user

Modified Paths:
--------------
    trunk/squirrelmail/functions/mailbox_display.php
    trunk/squirrelmail/src/read_body.php

Modified: trunk/squirrelmail/functions/mailbox_display.php
===================================================================
--- trunk/squirrelmail/functions/mailbox_display.php	2007-05-18 10:17:30 UTC (rev \
                12412)
+++ trunk/squirrelmail/functions/mailbox_display.php	2007-05-18 10:41:02 UTC (rev \
12413) @@ -1381,9 +1381,9 @@
              break;
         }
         /**
-         * Updates messages is an array containing the result of the untagged
+         * $aUpdatedMsgs is an array containing the result of the untagged
          * fetch responses send by the imap server due to a flag change. That
-         * response is parsed in a array with msg arrays by the parseFetch function
+         * response is parsed in an array with msg arrays by the parseFetch function
          */
         if ($aUpdatedMsgs) {
             // Update the message headers cache
@@ -1398,6 +1398,31 @@
                         $aMailbox['MSG_HEADERS'][$iUid]['FLAGS'] = $aMsg['FLAGS'];
                     }
                     /**
+                     * Also update flags in message object
+                     */
+//FIXME: WHY are we keeping flags in TWO places?!?  This is error-prone and some \
core code uses the is_xxxx message object values while other code uses the flags \
array above.  That's a mess. +                    if \
(isset($aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT'])) { +                        \
$message = $aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT']; +                       \
$message->is_seen = false; +                        $message->is_answered = false;
+                        $message->is_deleted = false;
+                        $message->is_flagged = false;
+                        $message->is_mdnsent = false;
+                        foreach ($aMsg['FLAGS'] as $flag => $value) {
+                            if (strtolower($flag) == '\\seen' && $value)
+                                $message->is_seen = true;
+                            else if (strtolower($flag) == '\\answered' && $value)
+                                $message->is_answered = true;
+                            else if (strtolower($flag) == '\\deleted' && $value)
+                                $message->is_deleted = true;
+                            else if (strtolower($flag) == '\\flagged' && $value)
+                                $message->is_flagged = true;
+                            else if (strtolower($flag) == '$mdnsent' && $value)
+                                $message->is_mdnsent = true;
+                        }
+                        $aMailbox['MSG_HEADERS'][$iUid]['MESSAGE_OBJECT'] = \
$message; +                    }
+                    /**
                      * Count the messages with the \Delete flag set so we can \
                determine
                      * if the number of expunged messages equals the number of \
                flagged
                      * messages for deletion.

Modified: trunk/squirrelmail/src/read_body.php
===================================================================
--- trunk/squirrelmail/src/read_body.php	2007-05-18 10:17:30 UTC (rev 12412)
+++ trunk/squirrelmail/src/read_body.php	2007-05-18 10:41:02 UTC (rev 12413)
@@ -877,9 +877,14 @@
 } else {
     $message = sqimap_get_message($imapConnection, $passed_id, $mailbox);
     $FirstTimeSee = !$message->is_seen;
-    $message->is_seen = true;
-    $aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message;
 }
+
+/**
+ * update message seen status and put in cache
+ */
+$message->is_seen = true;
+$aMailbox['MSG_HEADERS'][$passed_id]['MESSAGE_OBJECT'] = $message;
+
 if (isset($passed_ent_id) && $passed_ent_id) {
     $message = $message->getEntity($passed_ent_id);
     if ($message->type0 != 'message'  && $message->type1 != 'rfc822') {


This was sent by the SourceForge.net collaborative development platform, the world's \
largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
--
squirrelmail-cvs mailing list
List Address: squirrelmail-cvs@lists.sourceforge.net
List Info: https://lists.sourceforge.net/lists/listinfo/squirrelmail-cvs
http://squirrelmail.org/cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic