X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fmail%2FFileBasedMailbox.java;fp=src%2Forg%2Fibex%2Fmail%2FFileBasedMailbox.java;h=2340a16df7378e266b1b8e4bdb575b8175d635a9;hb=842351b4a6b67ebe088bf56347b919e24f447391;hp=e13e22dea9a4632b482d54af885473af023eed8f;hpb=a77dce86bef1c6592e873e922d3f8439c1a5b486;p=org.ibex.mail.git diff --git a/src/org/ibex/mail/FileBasedMailbox.java b/src/org/ibex/mail/FileBasedMailbox.java index e13e22d..2340a16 100644 --- a/src/org/ibex/mail/FileBasedMailbox.java +++ b/src/org/ibex/mail/FileBasedMailbox.java @@ -68,6 +68,7 @@ public class FileBasedMailbox extends Mailbox.Default { // acquire lock File lockfile = new File(this.path.getAbsolutePath() + slash + ".lock"); lock = new RandomAccessFile(lockfile, "rw").getChannel().tryLock(); + // FIXME!!! /* if (lock == null) { Log.warn(this, "warning: blocking waiting for a lock on " + path); @@ -169,21 +170,20 @@ public class FileBasedMailbox extends Mailbox.Default { // UGLY: Apple Mail doesn't like UID=0, so we add one public int uid() { return done() ? -1 : 1+Integer.parseInt(files[cur].substring(0, files[cur].length()-1)); } - public void delete() { File f = file(); if (f != null && f.exists()) f.delete(); } - public int getFlags() { - return file().lastModified()==MAGIC_DATE ? 0 : Flag.SEEN; - } - public void setFlags(int flags) { + public int getFlags() { return file().lastModified()==MAGIC_DATE ? 0 : Flag.SEEN; } + public void setFlags(int flags) { File f = file(); if ((flags & Mailbox.Flag.SEEN) == 0) f.setLastModified(MAGIC_DATE); else if (f.lastModified()==MAGIC_DATE) f.setLastModified(System.currentTimeMillis()); - // FIXME + // FIXME: other flags? } public Headers head() { return done() ? null : new Headers(new Fountain.File(file())); } public Message cur() { return Message.newMessage(new Fountain.File(file())); } } + // there's no reason this has to operate on a FileBasedMailbox -- it could operate on arbitrary mailboxes! + // use this for file attachments: http://jakarta.apache.org/commons/fileupload/ public static class Servlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException { doGet(request, response); } private void frames(HttpServletRequest request, HttpServletResponse response, boolean top) throws IOException {