update Script.java
authoradam <adam@megacz.com>
Sat, 17 Mar 2007 09:02:28 +0000 (09:02 +0000)
committeradam <adam@megacz.com>
Sat, 17 Mar 2007 09:02:28 +0000 (09:02 +0000)
darcs-hash:20070317090228-5007d-87585e66cb26cd3e601e3655d6eda0fc58e79c52.gz

src/org/ibex/mail/Script.java
src/org/ibex/mail/SqliteJdbcMailbox.java

index d3b118f..332aa99 100644 (file)
@@ -5,6 +5,7 @@
 package org.ibex.mail;
 import org.ibex.js.*;
 import org.ibex.io.*;
+import org.ibex.io.Fountain;
 import org.ibex.util.*;
 import org.ibex.mail.filter.*;
 import org.ibex.mail.target.*;
@@ -199,7 +200,9 @@ public class Script extends JS.Obj implements Target {
                     if (envelopeTo == null) envelopeTo = to;
                     if (envelopeFrom == null) envelopeFrom = from;
                     Message message =
-                        Message.newMessage(new org.ibex.io.Fountain.StringFountain(headers.toString() + "\r\n" + body),
+                        Message.newMessage(Fountain.Util.concat(Fountain.Util.create(headers.toString()),
+                                                                Fountain.Util.create("\r\n"),
+                                                                Fountain.Util.create(body)),
                                            envelopeFrom,
                                            envelopeTo
                                            );
@@ -209,7 +212,7 @@ public class Script extends JS.Obj implements Target {
                         if (attempt) {
                             org.ibex.mail.SMTP.Outgoing.attempt(message);
                         } else {
-                            org.ibex.mail.SMTP.Outgoing.accept(message);
+                            org.ibex.mail.SMTP.Outgoing.enqueue(message);
                         }
                         ok = true;
                     } catch (Exception ex) {
@@ -239,7 +242,7 @@ public class Script extends JS.Obj implements Target {
                             public void accept(Message m) throws MailException {
                                 try {
                                     Message m2 = m.bounce(JSU.toString(a));
-                                    org.ibex.mail.SMTP.Outgoing.accept(m2);
+                                    org.ibex.mail.SMTP.Outgoing.enqueue(m2);
                                     Log.error(this, "BOUNCING! " + m2.summary());
                                 } catch (Exception e) {
                                     Log.warn(this, e);
@@ -248,10 +251,10 @@ public class Script extends JS.Obj implements Target {
                 }
                 if (name.equals("mail.forward2") || name.equals("forward2")) {
                     try {
-                        Message m2 = Message.newMessage(new org.ibex.io.Fountain.StringFountain(m.toString()),
+                        Message m2 = Message.newMessage(m,
                                                         m.envelopeFrom,
                                                         new Address(JSU.toString(a)));
-                        org.ibex.mail.SMTP.Outgoing.accept(m2);
+                        org.ibex.mail.SMTP.Outgoing.enqueue(m2);
                     } catch (Exception e) {
                         Log.warn(this, e);
                         throw new JSExn(e.toString());
index af8ee5c..3ae5165 100644 (file)
@@ -67,7 +67,9 @@ public class SqliteJdbcMailbox extends Mailbox.Default {
                 query.setString(1, rs.getString(1));
                 ResultSet rs2 = query.executeQuery();
                 if (!rs.next()) return null;
-                m = Message.newMessage(new Fountain.StringFountain(rs.getString(1) + "\r\n\r\n" + rs.getString(2)));
+                m = Message.newMessage(Fountain.Util.concat(Fountain.Util.create(rs.getString(1)),
+                                                            Fountain.Util.create("\r\n\r\n"),
+                                                            Fountain.Util.create(rs.getString(2))));
                 flags = rs.getInt(3);
                 return m;
             } catch (Exception e) { throw new RuntimeException(e); }