diff --git a/mailboxes/boxes-lib.pl b/mailboxes/boxes-lib.pl
index 332f6373a..e36e87aa5 100644
--- a/mailboxes/boxes-lib.pl
+++ b/mailboxes/boxes-lib.pl
@@ -1310,25 +1310,26 @@ while($lines[++$l]) {
return $data;
}
-# simplify_date(datestring)
+# simplify_date(datestring, [format])
# Given a date from an email header, convert to the user's preferred format
sub simplify_date
{
-local $u = &parse_mail_date($_[0]);
+local ($date, $fmt) = @_;
+local $u = &parse_mail_date($date);
if ($u) {
- local $fmt = $userconfig{'date_fmt'} || $config{'date_fmt'} || "dmy";
+ $fmt ||= $userconfig{'date_fmt'} || $config{'date_fmt'} || "dmy";
local $strf = $fmt eq "dmy" ? "%d/%m/%Y" :
$fmt eq "mdy" ? "%m/%d/%Y" :
"%Y/%m/%d";
return strftime("$strf %H:%M", localtime($u));
}
-elsif ($_[0] =~ /^(\S+),\s+0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
+elsif ($date =~ /^(\S+),\s+0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
return "$2/$3/$4 $5:$6";
}
-elsif ($_[0] =~ /^0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
+elsif ($date =~ /^0*(\d+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+)/) {
return "$1/$2/$3 $4:$5";
}
-return $_[0];
+return $date;
}
# simplify_from(from)
@@ -2457,6 +2458,13 @@ my $rv = eval {
$7 < 50 ? $7+100 : $7 < 1000 ? $7 : $7-1900);
return $tm;
}
+ elsif ($str =~ /^(\S+)\s+(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)/) {
+ # Format like Tue Dec 7 12:58:52
+ local @now = localtime(time());
+ local $tm = timelocal($6, $5, $4, $3, &month_to_number($2),
+ $now[5]);
+ return $tm;
+ }
elsif ($str =~ /^(\S+)\s+(\d+)\s+(\d+):(\d+):(\d+)\s+(\d+)\s+(\S+)/) {
# Format like Dec 7 12:58:52 2004 GMT
local $tm = timelocal($5, $4, $3, $2, &month_to_number($1),
diff --git a/postfix/CHANGELOG b/postfix/CHANGELOG
index 750483f2b..0d42d9b56 100644
--- a/postfix/CHANGELOG
+++ b/postfix/CHANGELOG
@@ -62,3 +62,5 @@ Converted all pages to use the new Webmin UI library, for a more consistent and
Autoreply messages containing non-ASCII characters are now properly quoted-printable encoded.
---- Changes since 1.440 ----
Added a module config option to control if the user is prompted for confirmation before deleting queued messages.
+---- Changes since 1.450 ----
+Changed the mail queue date format to yyyy/mm/dd, for easier sorting.
diff --git a/sendmail/CHANGELOG b/sendmail/CHANGELOG
index 5f59d9c00..5c399769a 100644
--- a/sendmail/CHANGELOG
+++ b/sendmail/CHANGELOG
@@ -40,3 +40,5 @@ Autoreply messages containing non-ASCII characters are now properly quoted-print
---- Changes since 1.440 ----
Added a Module Config option to control if the user is prompted for confirmation before deleting queued messages.
A custom command to rebuild all maps can be specified on the Module Config page, to be used instead of makemap or newaliases.
+---- Changes since 1.450 ----
+Changed the mail queue date format to yyyy/mm/dd, for easier sorting.
diff --git a/sendmail/sendmail-lib.pl b/sendmail/sendmail-lib.pl
index bb131b706..82c5e235d 100644
--- a/sendmail/sendmail-lib.pl
+++ b/sendmail/sendmail-lib.pl
@@ -611,7 +611,7 @@ foreach my $f (@$qfiles) {
else {
push(@cols, $n);
}
- push(@cols, "$mail->{'header'}->{'date'}") if ($show{'Date'});
+ push(@cols, "".&simplify_date($mail->{'header'}->{'date'}, "ymd")."") if ($show{'Date'});
push(@cols, "$mail->{'header'}->{'from'}") if ($show{'From'});
push(@cols, "$mail->{'header'}->{'to'}") if ($show{'To'});
push(@cols, "$mail->{'header'}->{'cc'}") if ($show{'Cc'});