From 582bbe275f695673362827db6d007a73936100a4 Mon Sep 17 00:00:00 2001 From: stekkel Date: Mon, 18 Apr 2005 18:05:41 +0000 Subject: [PATCH] Show email address as title attribute if we only show the personal name of 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 | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/functions/mailbox_display.php b/functions/mailbox_display.php index aa0a8866..497a75f2 100644 --- a/functions/mailbox_display.php +++ b/functions/mailbox_display.php @@ -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; } } -- 2.25.1