add a date field if not present (rfc2822 requirement)
[org.ibex.mail.git] / src / org / ibex / mail / Message.java
index 46435f3..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?
     }
 
@@ -127,7 +132,6 @@ public class Message extends MIME.Part {
     }
 
     // this is belived to be compliant with QSBMF (http://cr.yp.to/proto/qsbmf.txt)
-v v v v v v v
     public Message bounce(String reason) {
         if (envelopeFrom==null || envelopeFrom.toString().equals("")) return null;
 
@@ -160,27 +164,6 @@ v v v v v v v
             return null;
         }
     }
-*************
-v v v v v v v
-    public Message bounce(String reason) {
-        Log.warn(Message.class, "bounce not implemented");
-        return null;
-    }  // FIXME!
-    
-*************
-    public Message bounce(String reason) {
-        Log.warn(Message.class, "bounce not implemented");
-    }  // FIXME!
-    
-^ ^ ^ ^ ^ ^ ^
-    public String summary() {
-        return
-            "          Subject: " + subject + "\n" +
-            "     EnvelopeFrom: " + envelope.from + "\n" +
-            "       EnvelopeTo: " + envelope.to + "\n" +
-            "        MessageId: " + messageid;
-    }
-^ ^ ^ ^ ^ ^ ^
 
     public String toString() { throw new RuntimeException("Message.toString() called"); }
     public String summary() { return "[" + envelopeFrom + " -> " + envelopeTo + "] " + subject; }