Hi Jeff,
I'm sorry you had problems with my previous date code - hope it hasn't
caused you much grief. I just didn't realise there were mail clients out
there which produced malformed date strings (well, ones that date(1) can't
read at least).
The last patch to mailme I sent was (again) incorrect as it didn't
take care of multiple Received: lines, and the junk on a Received line
before the semicolon. I've attached a patch (again from your original
source) which deals with this (it uses the top Received: line which I think
is safest), and also skips the date code completely unless it's a monthly
list, just so that any problems don't affect non-monthly lists at all. But
providing x-archive-with-list is formatted ok, or Received: lines are
sensible (which come from your server so they are), malformed dates
hopefully should be a thing of the past.
With regard to attachments: I copied over your own MIMEargs (just added a
"target="), and I've gone back and regenerated my archives here with your
rcfile alone: and yes, I think it's with text/plain attachments that the
msg* subdirectory gets created. I don't know why they don't tack
.dir on the end for these attachments, at least here, but I'm sure
it's not a worry.
Paul
--- mailme.jeff Mon Sep 6 21:17:09 1999
+++ mailme Mon Sep 6 21:01:19 1999
@@ -103,6 +103,25 @@
} '
}
+# Special case of grab() for Received: lines
+# This is because we want to take first occurrence
+# Example usage: cat messageheaders | receiveme
+receiveme() {
+ $NAWK '
+ BEGIN {
+ m = "^Received:"
+ }
+ {
+ if (match($0, m)) {
+ print $0
+ getline
+ while ( $0 ~ /^[ \t]+/) {
+ print $0; getline
+ }
+ }
+ } '
+}
+
# Get all email addresses, and precede them with a carat.
# Example usage: cat RMAIL | waterfall
waterfall () {
@@ -318,10 +337,6 @@
X13=`echo "$T" | grab "mailing-list"` #use later
X14=`echo "$T" | grab "list-post"`
-# If indexing by month, we care about the date
-DATE=`echo "$T" | grab "date"`
-JUSTDATE=`echo $DATE | sed 's/^date: //i'`
-
# Extract email addresses
CHANCE=$(echo $TO $CC $X1 $X2 $X3 $X4 $X5 $X6 $X7 $X8 $X9 $X10 $X11 $X14 |\
waterfall)
@@ -453,6 +468,29 @@
MONFLAG=$HOME/vault/$ESCAPED_NAME/monthly
if [ -f $MONFLAG ]
then
+
+# If indexing by month, we care about the date
+# If importing, see if x-archive-with-date is set first.
+# Use "Date:" as last resort because of mis-set clocks.
+ XDATE=`echo "$T" | grab "x-archive-with-date"`
+ [ ! "$XDATE" ] && XDATE=`echo "$T" | receiveme`
+ [ ! "$XDATE" ] && XDATE=`echo "$T" | grab "date"`
+ if [ ! "$XDATE" ]
+ then
+ emergency_divert NODATE "Unable to find any date field."
+ exit -1
+ fi
+ JUSTDATE=`echo "$XDATE" | sed -e 's/^date: //i' \
+ -e 's/^x-archive-with-date: //i' \
+ -e 's/^received:.*; //i'`
+ date -d "$JUSTDATE" > /dev/null 2>&1
+ ex=$?
+ if [ "$ex" != "0" ]
+ then
+ emergency_divert NODATE "Unable to find valid date field."
+ exit -1
+ fi
+
echok info "Now switching to monthly indexing"
YYYYMM=`date -d "$JUSTDATE" +"%Y-month-%m"`
MONBEG=`date -d "$JUSTDATE" +"%m/01/%Y:00:00:00.00"`