moved address-parsing to the displayable headers
[squirrelmail.git] / functions / mailbox_display.php
index 5523fd53844cdaac18f1bf1a184c429cfb86ccd0..97f1418bbac8958512b97d7e590d1ded1fd80ff0 100644 (file)
@@ -73,6 +73,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
     if (handleAsSent($mailbox)) {
        $msg['FROM'] = $msg['TO'];
     }
+    $msg['FROM'] = parseAddress($msg['FROM']);
+    
        /*
         * This is done in case you're looking into Sent folders,
         * because you can have multiple receivers.
@@ -93,9 +95,9 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
         }
     }
 
-    $subject_full = decodeHeader($msg['SUBJECT']);
-    $subject = processSubject($subject_full, $indent_array[$msg['ID']]);
-
+    $msg['SUBJECT'] = decodeHeader($msg['SUBJECT']);
+    $subject = processSubject($msg['SUBJECT'], $indent_array[$msg['ID']]);
+    
     echo html_tag( 'tr','','','','VALIGN="top"') . "\n";
 
     if (isset($msg['FLAG_FLAGGED']) && ($msg['FLAG_FLAGGED'] == true)) {
@@ -137,6 +139,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
     * Who wrote this?!
     */
     if (is_array($message_highlight_list) && count($message_highlight_list)) {
+       $msg['TO'] = parseAddress($msg['TO']);
+       $msg['CC'] = parseAddress($msg['CC']);
         foreach ($message_highlight_list as $message_highlight_list_part) {
             if (trim($message_highlight_list_part['value']) != '') {
                 $high_val   = strtolower($message_highlight_list_part['value']);
@@ -145,6 +149,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
                     case('TO'):
                     case('TO_CC'):
                         foreach ($msg['TO'] as $address) {
+                            $address[0] = decodeHeader($address[0]);
+                            $address[1] = decodeHeader($address[1]);
                             if (strstr('^^' . strtolower($address[0]), $high_val) ||
                                 strstr('^^' . strtolower($address[1]), $high_val)) {
                                 $hlt_color = $message_highlight_list_part['color'];
@@ -156,6 +162,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
                         }
                     case('CC'):
                         foreach ($msg['CC'] as $address) {
+                            $address[0] = decodeHeader($address[0]);
+                            $address[1] = decodeHeader($address[1]);
                             if( strstr('^^' . strtolower($address[0]), $high_val) ||
                                 strstr('^^' . strtolower($address[1]), $high_val)) {
                                 $hlt_color = $message_highlight_list_part['color'];
@@ -165,6 +173,8 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
                         break;
                     case('FROM'):
                         foreach ($msg['FROM'] as $address) {
+                            $address[0] = decodeHeader($address[0]);
+                            $address[1] = decodeHeader($address[1]);
                             if( strstr('^^' . strtolower($address[0]), $high_val) ||
                                 strstr('^^' . strtolower($address[1]), $high_val)) {
                                 $hlt_color = $message_highlight_list_part['color'];
@@ -226,11 +236,11 @@ function printMessageInfo($imapConnection, $t, $not_last=true, $key, $mailbox,
                 $td_str .= '<a href="read_body.php?mailbox='.$urlMailbox
                         .  '&amp;passed_id='. $msg["ID"]
                         .  '&amp;startMessage='.$start_msg.$searchstr.'"';
-                do_hook("subject_link");
-                if ($subject != $subject_full) {
+                $td_str .= ' ' .concat_hook_function('subject_link'); 
+                if ($subject != $msg['SUBJECT']) {
                     $title = get_html_translation_table(HTML_SPECIALCHARS);
                     $title = array_flip($title);
-                    $title = strtr($subject_full, $title);
+                    $title = strtr($msg['SUBJECT'], $title);
                     $title = str_replace('"', "''", $title);
                     $td_str .= " title=\"$title\"";
                 }