formatting
[org.ibex.mail.git] / src / org / ibex / mail / MailingList.java
index 0a2baa6..7cc661a 100644 (file)
@@ -13,6 +13,11 @@ import java.net.*;
 import javax.servlet.*;
 import javax.servlet.http.*;
 
+// TODO: RFC 2919 (List-ID)
+// TODO: RFC 2142 (*-Request@)
+// TODO: RFC 2369 (URLs as Meta-Syntax)
+
+// FEATURE: store interesting/important stuff in sqlite
 public class MailingList extends Mailbox.MailboxWrapper {
 
     // FIXME
@@ -188,9 +193,11 @@ public class MailingList extends Mailbox.MailboxWrapper {
         try {
             StringBuffer buf = new StringBuffer();
             m.getBody().getStream().transcribe(buf);
-            Headers head = new Headers.Original(m.headers.getStream());
-            head = head.set("List-Id", one_line_description + "<"+address+">");
-            head = head.set("Subject", properties.get("prefix") + " " + head.get("Subject"));
+            Headers head = new Headers(m.headers,
+                                       new String[] {
+                                           "List-Id", one_line_description + "<"+address+">",
+                                           "Subject", properties.get("prefix") + " " + m.headers.get("Subject")
+                                       });
             
             m = Message.newMessage(Fountain.Util.concat(new Fountain[] { head, 
                                                                          Fountain.Util.create("\r\n"),
@@ -200,7 +207,7 @@ public class MailingList extends Mailbox.MailboxWrapper {
             
             for(Subscriber s : subscribers()) try {
                     Log.warn(MailingList.class, "  trying " + s.address);
-                    SMTP.enqueue(Message.newMessage(m, m.envelopeFrom, s.address));
+                    SMTP.enqueue(m.withEnvelope(m.envelopeFrom, s.address));
                     Log.warn("[list]", "successfully sent to " + s);
                 } catch (Exception e2) { Log.error("[list]", e2); }
         } catch (Exception e) { throw new RuntimeException(e); }