Getting ready for 1.2.0 release.
[squirrelmail.git] / functions / mailbox_display.php
index 46f5f6cfd3a8c66e732de5c97ab1db945493a28c..d209aa51c13503596d4d1828c9cac3104c597f21 100644 (file)
@@ -3,7 +3,7 @@
 /**
  * mailbox_display.php
  *
- * Copyright (c) 1999-2001 The SquirrelMail Development Team
+ * Copyright (c) 1999-2002 The SquirrelMail Project Team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * This contains functions that display mailbox information, such as the
@@ -62,7 +62,7 @@ function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $start
         $bold_end = '';
     }
 
-    if (($mailbox == $sent_folder) || ($mailbox == $draft_folder)) {
+    if (handleAsSent($mailbox)) {
         $italic = '<i>';
         $italic_end = '</i>';
     } else {
@@ -188,7 +188,7 @@ function showMessagesForMailbox
     }
     sqimap_mailbox_select($imapConnection, $mailbox);
 
-    $issent = (($mailbox == $sent_folder) || ($mailbox == $draft_folder));
+    $issent = handleAsSent($mailbox);
     if (!$use_cache) {
         /* If it is sorted... */
         if ($num_msgs >= 1) {
@@ -385,8 +385,7 @@ function displayMessageArray($imapConnection, $num_msgs, $start_msg, &$msgs, $ms
         $msg = '';
     }
 
-    mail_message_listing_beginning
-        ($imapConnection,
+    mail_message_listing_beginning( $imapConnection,
         "move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$start_msg",
         $mailbox, $sort, $msg_cnt_str, $paginator_str, $start_msg);
 
@@ -544,8 +543,7 @@ function mail_message_listing_beginning
             break;
 
         case 2: /* from */
-            if (($mailbox == $sent_folder)
-                    || ($mailbox == $draft_folder)) {
+            if (handleAsSent($mailbox)) {
                 echo '   <TD WIDTH="25%"><B>'. _("To") .'</B>';
             } else {
                 echo '   <TD WIDTH="25%"><B>'. _("From") .'</B>';
@@ -892,4 +890,19 @@ function processSubject($subject) {
     return substr($subject, 0, $trim_val) . '...';
 }
 
+function handleAsSent($mailbox) {
+    global $sent_folder, $draft_folder;
+    global $handleAsSent_result;
+
+    /* First check if this is the sent or draft folder. */
+    $handleAsSent_result = (($mailbox == $sent_folder)
+                        || ($mailbox == $draft_folder));
+
+    /* Then check the result of the handleAsSent hook. */
+    do_hook('check_handleAsSent_result', $mailbox);
+
+    /* And return the result. */
+    return ($handleAsSent_result);
+}
+
 ?>