bugfixes
authoradam <adam@megacz.com>
Mon, 9 Jul 2007 04:56:43 +0000 (04:56 +0000)
committeradam <adam@megacz.com>
Mon, 9 Jul 2007 04:56:43 +0000 (04:56 +0000)
darcs-hash:20070709045643-5007d-329aa126a6be91911996848ac48204d1f4e36ec6.gz

src/org/ibex/mail/MailTree.java
src/org/ibex/mail/Mailbox.java
src/org/ibex/mail/Message.java

index 4a6a587..cca13b9 100644 (file)
@@ -35,7 +35,7 @@ public interface MailTree {
     public static abstract class AclWrapper extends Wrapper {
         protected Acl.Entry acl;
         public AclWrapper(MailTree mt, Acl.Entry acl) { super(mt); this.acl = acl; }
-        public Mailbox      getMailbox() { return new Mailbox.AclWrapper(mt.getMailbox(), acl); }
+        public Mailbox getMailbox() { return new Mailbox.AclWrapper(mt.getMailbox(), acl); }
         public void rmdir(String subdir) {
             if (!acl.delete) throw new Acl.PermissionDenied();
             super.rmdir(subdir);
@@ -52,8 +52,8 @@ public interface MailTree {
         public RecursiveAclWrapper(MailTree mt, Acl.Entry acl) { super(mt, acl); }
         public MailTree slash(String name, boolean create) {
             if (!acl.list) throw new Acl.PermissionDenied();
-            if (!acl.mkdirs) create = false;
-            return new RecursiveAclWrapper(super.slash(name, create), acl);
+            if (!acl.mkdir) create = false;
+            return new RecursiveAclWrapper(mt.slash(name, create), acl);
         }
     }
 }
index 59c8268..e305cc4 100644 (file)
@@ -56,6 +56,7 @@ public abstract class Mailbox extends JS.Obj implements Target {
         }
         public static abstract class Iterator implements Mailbox.Iterator {
             // FIXME: NNTP spec allows us to use longs (64-bit) here
+            // FIXME: NNTP spec requires that the minimum nntpNumber of a group must never, ever decrease (no, that's not a typo)
             public int     nntpNumber() { throw new MailException("not supported"); }
             public int     getFlags() { return 0; }
             public void    setFlags(int flags) { throw new MailException("not supported"); }
@@ -169,7 +170,7 @@ public abstract class Mailbox extends JS.Obj implements Target {
         public int              uidValidity()  { return m.uidValidity(); }
     }
 
-    public static abstract class AclWrapper extends MailboxWrapper {
+    public static class AclWrapper extends MailboxWrapper {
         private Mailbox m;
         private Acl.Entry acl;
         public AclWrapper(Mailbox m, Acl.Entry acl) { super(m); this.acl = acl; }
index 73ab0f8..b1c8e0a 100644 (file)
@@ -176,5 +176,19 @@ public class Message extends MIME.Part {
     public final String summary() { return "[" + envelopeFrom + " -> " + envelopeTo + "] " + subject; }
 
     public static class Malformed extends MailException { public Malformed(String s) { super(s); } }
+
+    /** reads an SMTP-style dot-escaped message */
+    static Message readDotEncodedMessage(Stream conn) {
+        StringBuffer buf = new StringBuffer();
+        while(true) {
+            String s = conn.readln();
+            if (s == null) throw new RuntimeException("connection closed");
+            if (s.equals(".")) break;
+            if (s.startsWith(".")) s = s.substring(1);
+            buf.append(s);
+            buf.append("\r\n");
+        }
+        return Message.newMessage(new Fountain.StringFountain(buf.toString()));
+    }
 }