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);
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);
}
}
}
}
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"); }
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; }
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()));
+ }
}