it compiles
[org.ibex.mail.git] / src / org / ibex / mail / Message.java
index c593a8a..85ab516 100644 (file)
@@ -9,7 +9,7 @@ import java.io.*;
 
 // soft line limit (suggested): 78 chars /  hard line limit: 998 chars
 // folded headers: can insert CRLF anywhere that whitespace appears (before the whitespace)
-// date/time parsing: see 3.3
+// date/time parsing: see spec, 3.3
 
 // FEATURE: MIME RFC2045, 2046, 2049
 // FEATURE: PGP-signature-parsing
@@ -37,7 +37,7 @@ public class Message extends JSReflection {
     public final Address envelopeFrom;
     public final Address[] envelopeTo;
 
-    public final Date arrival = null;   // when the message first arrived at this machine
+    public final Date arrival;         // when the message first arrived at this machine
     
     public void dump(OutputStream os) throws IOException {
         Writer w = new OutputStreamWriter(os);
@@ -47,6 +47,7 @@ public class Message extends JSReflection {
         w.flush();
     }
 
+        /*
     public static class StoredMessage extends Message {
         public int uid;
         public boolean deleted = false;
@@ -54,6 +55,7 @@ public class Message extends JSReflection {
         public boolean answered = false;
         public StoredMessage(LineReader rs) throws IOException, MailException.Malformed { super(rs); }
     }
+        */
 
     public class Trace {
         final String returnPath;
@@ -94,7 +96,7 @@ public class Message extends JSReflection {
     }
 
     public static class Malformed extends MailException.Malformed { public Malformed(String s) { super(s); } }
-    public Message(Address envelopeFrom, Address envelopeTo, LineReader rs) throws IOException, Malformed {
+    public Message(Address envelopeFrom, Address[] envelopeTo, LineReader rs) throws IOException, MailException.Malformed {
         this.envelopeFrom = envelopeFrom;
         this.envelopeTo = envelopeTo;
         this.arrival = new Date();
@@ -132,7 +134,7 @@ public class Message extends JSReflection {
             }            
         }
 
-        this.date      = headers.get("Date");
+        this.date      = (Date)headers.get("Date");
         this.to        = new Address((String)headers.get("To"));
         this.from      = new Address((String)headers.get("From"));
         this.replyto   = new Address((String)headers.get("Reply-To"));
@@ -141,14 +143,14 @@ public class Message extends JSReflection {
         if (headers.get("Cc") != null) {
             StringTokenizer st = new StringTokenizer((String)headers.get("Cc"));
             this.cc = new Address[st.countTokens()];
-            for(int i=0; i<cc.length; i++) cc[i] = st.nextToken();
+            for(int i=0; i<this.cc.length; i++) this.cc[i] = new Address(st.nextToken());
         } else {
             this.cc = new Address[0];
         }
         if (headers.get("Bcc") != null) {
             StringTokenizer st = new StringTokenizer((String)headers.get("Bcc"));
             this.bcc = new Address[st.countTokens()];
-            for(int i=0; i<bcc.length; i++) bcc[i] = st.nextToken();
+            for(int i=0; i<this.bcc.length; i++) this.bcc[i] = new Address(st.nextToken());
         } else {
             this.bcc = new Address[0];
         }
@@ -176,10 +178,10 @@ public class Message extends JSReflection {
 
     public String summary() {
         return
-            "          Subject: " + m.subject + "\n" +
-            "     EnvelopeFrom: " + m.envelopeFrom + "\n" +
-            "       EnvelopeTo: " + m.envelopeTo + "\n" +
-            "        MessageId: " + m.messageid;
+            "          Subject: " + subject + "\n" +
+            "     EnvelopeFrom: " + envelopeFrom + "\n" +
+            "       EnvelopeTo: " + envelopeTo + "\n" +
+            "        MessageId: " + messageid;
     }
 
     public Message bounce(String reason) {