change seen within a transaction in FileBasedMailbox
[org.ibex.mail.git] / src / org / ibex / mail / target / FileBasedMailbox.java
index ca4e0da..4322673 100644 (file)
@@ -97,13 +97,14 @@ public class FileBasedMailbox extends Mailbox.Default {
             public MIME.Headers headers() { return new MIME.Headers(new Stream(new ByteArrayInputStream(header)), true); }
             public Entry(Cache cache, Prevayler prevayler, String name) throws IOException {
                 File f = new File(cache.dir.getParent()+slash+name);
-                seen = f.lastModified() == MAGIC_DATE;
+                final boolean seen = f.lastModified() == MAGIC_DATE;
                 this.name = name;
                 header = new MIME.Headers(new Stream(new FileInputStream(f)), true).toString().getBytes();
                 prevayler.execute(new Transaction() {
                         public void executeOn(Object o, Date now) {
                             Cache cache = (Cache)o;
                             synchronized(cache) {
+                                Entry.this.seen = seen;
                                 Entry.this.uid = cache.uidNext(true);
                                 cache.linear.add(Entry.this);
                                 cache.byuid.put(Entry.this.uid, Entry.this);