[dev] [patch] mailbox.php From column status text improvements

Derek P. Moore derekm at hackunix.org
Tue Apr 6 10:29:27 PDT 2004


> It's not redundant because the status contains the full from address while
> the address in the mailbox list may contain a shortened version if it
> exceeds the configured maximum length.

Well, the logic is a bit more complex than that...  Let's examine mailbox.php.

First of all, the From column is generated from the $msg['from'] variable, and
the From status text is generated from $msg['fullfrom'].

At line 510 of mailbox.php, initialization of the message header fields 
begins.
Here's where $msg['from'] is initialized to the HTML character entity of a
non-breaking space.  Most other header variables are initialized here, but
$msg['fullfrom'] isn't.

At line 545, $msg['from'] is properly set and formatted.  This takes about 44
lines of code.

The address list of the From field is parsed according to RFC822 and the first
element of the array returned is considered the From address.  In most cases,
$msg['from'] goes on to get set to the Personal part of the From address, as
most email clients these days specify a Personal part.

While all this is going on, the bare address is set to $from_adr.

At this point, if trimming $msg['from'] (which is holding the contents of the
RFC822 Personal part of the From address) for ASCII spaces (char 32) or
non-breaking spaces (char 160) returns an empty string, $msg['from'] gets set
to the bare address part of the From header, $from_adr.

It goes on that if $from_adr is null, $msg['from'] is set to "Invalid 
Address".
And if $from_adr contains one of your email addresses, $msg['from'] is set to
the message's To information.

After all of this $msg['fullfrom'] is finally defined and set to the value of
$msg['from'].  And last but not least, $msg['from'] is truncated to the 
defined
length of the From column.

In other words, the status text will always be the same as the From 
column text
in mailbox views, whether it contains only the Personal part or only the bare
address; unless $msg['from'] is ellipsized (which is very rare), in which case
the status text contains a tiny bit more information.

In other other words, the status text will never contain both the 
Personal part
of an address and the bare address at the same time, which is what I 
find to be
usability enhancement for IMP.

My old patch would display the full, mostly-unadultered From or To headers
(depending upon the value of $mailto_link, of course) in the status text.

After analyzing the situation in this much depth, however, I have a new, more
thorough patch.

This new patch generally cleans up the From formatting code, adds a few 
missing
$showfromlink cases, and hopefully resolves some errors with respect to proper
handling of messages with undisclosed recipients.

Enjoy,

Derek

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mailbox.php.patch
Type: text/x-patch
Size: 3422 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/20040406/0af3a20e/mailbox.php-0001.bin


More information about the dev mailing list