major revamp due to new Message constructors
[org.ibex.mail.git] / src / org / ibex / mail / FileBasedMailbox.java
index e13e22d..2340a16 100644 (file)
@@ -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 {