add a date field if not present (rfc2822 requirement)
authoradam <adam@megacz.com>
Sat, 22 Jul 2006 22:29:57 +0000 (22:29 +0000)
committeradam <adam@megacz.com>
Sat, 22 Jul 2006 22:29:57 +0000 (22:29 +0000)
darcs-hash:20060722222957-5007d-ffdf05c6de98fad2d7ba187ba7d04fe944ebca37.gz

src/org/ibex/mail/Message.java

index 882ca9f..d6ef538 100644 (file)
@@ -100,6 +100,11 @@ public class Message extends MIME.Part {
         this.cc           = Address.list(headers.get("Cc"));
         this.bcc          = Address.list(headers.get("Bcc"));
         this.date         = parseDate(headers.get("Date")) == null ? new Date() : parseDate(headers.get("Date"));
+
+        // RFC2822 requires a "Date" field, so we synthesize one if missing
+        if (headers.get("Date") == null)
+            headers.set("Date", this.date.toString());   // FIXME: formatting
+
         this.arrival      = this.date; // FIXME wrong; grab this from traces?
     }