Show email address as title attribute if we only show the personal name of
authorstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 18 Apr 2005 18:05:41 +0000 (18:05 +0000)
committerstekkel <stekkel@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 18 Apr 2005 18:05:41 +0000 (18:05 +0000)
an email address.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9348 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox_display.php

index aa0a88667ac297ec339b0893559edd4d97e91779..497a75f219ee2d0ae12b7185aefda4fc309f02c5 100644 (file)
@@ -523,11 +523,35 @@ function prepareMessageList(&$aMailbox, $aProps) {
                         if ($highlight_list && !$bHighLight) {
                             $bHighLight = highlightMessage($aCol[$k], $value, $highlight_list,$aFormattedMessages[$iUid]);
                         }
-                        $sTmp = getAddressString(parseRFC822Address($value),array('best' => true));
+                        $aAddressList = parseRFC822Address($value);
+                        $sTmp = getAddressString($aAddressList,array('best' => true));
+                        $title = $title_maybe = '';
+                        foreach ($aAddressList as $aAddr) {
+                            $sPersonal = (isset($aAddr[SQM_ADDR_PERSONAL])) ? $aAddr[SQM_ADDR_PERSONAL] : '';
+                            $sMailbox  = (isset($aAddr[SQM_ADDR_MAILBOX]))  ? $aAddr[SQM_ADDR_MAILBOX]  : '';
+                            $sHost     = (isset($aAddr[SQM_ADDR_HOST]))     ? $aAddr[SQM_ADDR_HOST]     : '';
+                            if ($sPersonal) {
+                                $title .= htmlspecialchars($sMailbox.'@'.$sHost).', ';
+                            } else {
+                                // if $value gets truncated we need to add the addresses with no
+                                // personal name as well
+                                $title_maybe .= htmlspecialchars($sMailbox.'@'.$sHost).', ';
+                            }
+                        }
+                        if ($title) {
+                            $title = substr($title,0,-2); // strip ', ';
+                        }
                         $sTmp = decodeHeader($sTmp);
                         if (isset($aColumnDesc[$k]['truncate']) && $aColumnDesc[$k]['truncate']) {
                             $sTrunc = truncateWithEntities($sTmp, $aColumnDesc[$k]['truncate']);
-                            $title = ($sTrunc != $sTmp) ? htmlspecialchars($sTmp) : '';
+                            if ($sTrunc != $sTmp) {
+                                if (!$title) {
+                                    $title = htmlspecialchars($sTmp);
+                                } else if ($title_maybe) {
+                                    $title = $title .', '.$title_maybe;
+                                    $title = substr($title,0,-2); // strip ', ';
+                                }
+                            }
                             $sTmp = $sTrunc;
                         }
                     }