Adding myself.
[squirrelmail.git] / functions / mailbox_display.php
index e590ae90879c279e06d4faa5d58dadec9bb99c8a..2b1d756f5e0637967ca3fe572c6169377998bd93 100644 (file)
@@ -6,7 +6,7 @@
  * This contains functions that display mailbox information, such as the
  * table row that has sender, date, subject, etc...
  *
- * @copyright © 1999-2005 The SquirrelMail Project Team
+ * @copyright © 1999-2006 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -346,6 +346,12 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
         $id_slice = array_slice($aUid,$start_msg-1,$iLimit);
         /* do some funky cache checks */
         if (isset($aMailbox['MSG_HEADERS']) && is_array($aMailbox['MSG_HEADERS'])) {
+            // temp code, read_body del / next links fo not update fields.
+            foreach ($aMailbox['MSG_HEADERS'] as $iUid => $aValue) {
+                if (!isset($aValue['UID'])) {
+                    unset($aMailbox['MSG_HEADERS'][$iUid]);
+                }
+            }
             $aUidCached = array_keys($aMailbox['MSG_HEADERS']);
         } else {
             $aMailbox['MSG_HEADERS'] = array();
@@ -426,6 +432,10 @@ function fetchMessageHeaders($imapConnection, &$aMailbox) {
  * @author Marc Groot Koerkamp
  */
 function prepareMessageList(&$aMailbox, $aProps) {
+
+    /* Globalize link attributes so plugins can share in modifying them */
+    global $link, $title, $target, $onclick, $link_extra;
+
     /* retrieve the properties */
     $my_email_address = (isset($aProps['email'])) ? $aProps['email'] : false;
     $highlight_list   = (isset($aProps['config']['highlight_list'])) ? $aProps['config']['highlight_list'] : false;
@@ -514,7 +524,7 @@ function prepareMessageList(&$aMailbox, $aProps) {
         if (isset($aId[$i])) {
 
             $bHighLight = false;
-            $value = $title = $link = $target = '';
+            $value = $title = $link = $target = $onclick = $link_extra = '';
             $aQuery = ($aInitQuery !== false) ? $aInitQuery : false;
             $aMsg = $aHeaders[$aId[$i]];
             if (isset($aSearch) && count($aSearch) > 1 && $aQuery) {
@@ -528,7 +538,7 @@ function prepareMessageList(&$aMailbox, $aProps) {
             }
 
             foreach ($aCol as $k => $v) {
-                $link = $target = $title = '';
+                $title = $link = $target = $onclick = $link_extra = '';
                 $aColumns[$k] = array();
                 $value = (isset($aMsg[$v]))  ? $aMsg[$v]  : '';
                 $sUnknown = _("Unknown recipient");
@@ -597,6 +607,13 @@ function prepareMessageList(&$aMailbox, $aProps) {
                     if ($aQuery) {
                         // TODO, $sTargetModule should be a query parameter so that we can use a single entrypoint
                         $link = $sTargetModule.'.php?' . implode('&',$aQuery);
+
+                        // see top of this function for which attributes are available
+                        // in the global scope for plugin use (like $link, $target, 
+                        // $onclick, $link_extra, $title, and so forth)
+                        // plugins are responsible for sharing nicely (such as for 
+                        // setting the target, etc)
+                        do_hook('subject_link', array($iPageOffset, $sSearch, $aSearch));
                     }
                     $value = (trim($value)) ? $value : _("(no subject)");
                     /* add thread indentation */
@@ -640,9 +657,11 @@ function prepareMessageList(&$aMailbox, $aProps) {
                     break;
                 default : break;
                 }
-                if ($title)  { $aColumns[$k]['title']  = $title;  }
-                if ($link)   { $aColumns[$k]['link']   = $link;   }
-                if ($target) { $aColumns[$k]['target'] = $target; }
+                if ($title)      { $aColumns[$k]['title']      = $title;      }
+                if ($link)       { $aColumns[$k]['link']       = $link;       }
+                if ($link_extra) { $aColumns[$k]['link_extra'] = $link_extra; }
+                if ($onclick)    { $aColumns[$k]['onclick']    = $onclick;    }
+                if ($target)     { $aColumns[$k]['target']     = $target;     }
                 $aColumns[$k]['value']  = $value;
             }
             /* columns which will not be displayed but should be inspected
@@ -1257,7 +1276,7 @@ function handleMessageListForm($imapConnection,&$aMailbox,$sButton='',$aUid = ar
             $aUpdatedMsgs = sqimap_toggle_flag($imapConnection, $aUid, $sFlag, $bSet, true);
             break;
           case 'move':
-            $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection,$aUid,$targetMailbox);
+            $aUpdatedMsgs = sqimap_msgs_list_move($imapConnection,$aUid,$targetMailbox,true,$mailbox);
             sqsession_register($targetMailbox,'lastTargetMailbox');
             $bExpunge = true;
             break;
@@ -1431,4 +1450,4 @@ function attachSelectedMessages($imapConnection,$aMsgHeaders) {
     return $composesession;
 }
 
-?>
\ No newline at end of file
+?>