diff --git a/mailboxes/CHANGELOG b/mailboxes/CHANGELOG index da8fcce69..fca071d21 100644 --- a/mailboxes/CHANGELOG +++ b/mailboxes/CHANGELOG @@ -50,3 +50,4 @@ Fixed a bug that broke searching by message body contents. ---- Changes since 1.410 ---- Re-organized the Module Config page to make the first section less crowded. Added an option to skip messages flagged as deleted in a Maildir. +Detection of messages with attachments is now 100% accurate, rather than taking a guess based on the MIME type. diff --git a/mailboxes/list_mail.cgi b/mailboxes/list_mail.cgi index 73c7067f6..d9accc0b6 100755 --- a/mailboxes/list_mail.cgi +++ b/mailboxes/list_mail.cgi @@ -89,28 +89,36 @@ if (@mail) { print &ui_columns_start(\@hcols, 100, 0, \@tds); } -# Show rows for actual mail messages +# Get the mails +@showmail = ( ); for($i=$in{'start'}; $i<@mail && $i<$in{'start'}+$perpage; $i++) { - local $idx = $mail[$i]->{'idx'}; + push(@showmail, $mail[$i]); + } +@hasattach = &mail_has_attachments(\@showmail, $folder); + +# Show rows for actual mail messages +$i = 0; +foreach my $mail (@showmail) { + local $idx = $mail->{'idx'}; local $cols = 0; local @cols; - local $from = $mail[$i]->{'header'}->{$showto ? 'to' : 'from'}; + local $from = $mail->{'header'}->{$showto ? 'to' : 'from'}; $from = $text{'mail_unknown'} if ($from !~ /\S/); push(@cols, &view_mail_link($in{'user'}, $folder, $idx, $from)); if ($config{'show_to'}) { push(@cols, &simplify_from( - $mail[$i]->{'header'}->{$showto ? 'from' : 'to'})); + $mail->{'header'}->{$showto ? 'from' : 'to'})); } - push(@cols, &simplify_date($mail[$i]->{'header'}->{'date'})); - push(@cols, &nice_size($mail[$i]->{'size'}, 1024)); + push(@cols, &simplify_date($mail->{'header'}->{'date'})); + push(@cols, &nice_size($mail->{'size'}, 1024)); local $tbl; $tbl .= "
| ".&simplify_subject($mail[$i]->{'header'}->{'subject'}). + " | |
| ".&simplify_subject($mail->{'header'}->{'subject'}). " | ";
- if ($mail[$i]->{'header'}->{'content-type'} =~ /multipart\/\S+/i) {
+ if ($hasattach[$i]) {
$tbl .= " ";
}
- local $p = int($mail[$i]->{'header'}->{'x-priority'});
+ local $p = int($mail->{'header'}->{'x-priority'});
if ($p == 1) {
$tbl .= " ";
}
@@ -118,17 +126,17 @@ for($i=$in{'start'}; $i<@mail && $i<$in{'start'}+$perpage; $i++) {
$tbl .= " ";
}
if (!$showto) {
- if ($read{$mail[$i]->{'header'}->{'message-id'}} == 2) {
+ if ($read{$mail->{'header'}->{'message-id'}} == 2) {
$tbl .= " ";
}
- elsif ($read{$mail[$i]->{'header'}->{'message-id'}} == 1) {
+ elsif ($read{$mail->{'header'}->{'message-id'}} == 1) {
$tbl .= " ";
}
}
$tbl .= " |