]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
flag updates and expunge now set the cur/ dirty-synced to avoid extra sync
authorTimo Sirainen <tss@iki.fi>
Thu, 29 May 2003 14:15:57 +0000 (17:15 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 29 May 2003 14:15:57 +0000 (17:15 +0300)
after them.

--HG--
branch : HEAD

src/lib-index/maildir/maildir-expunge.c
src/lib-index/maildir/maildir-update-flags.c

index cdc2cad3f32a0d50bd24a08aa21ed7a6a1687670..6cdb37115bdc5cfd92614acc321fe45fde07f68d 100644 (file)
@@ -1,6 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "maildir-index.h"
 #include "mail-index-util.h"
 
@@ -54,7 +55,7 @@ int maildir_expunge_mail(struct mail_index *index,
        for (i = 0;; i++) {
                ret = maildir_expunge_mail_file(index, rec, &fname);
                if (ret > 0)
-                       return TRUE;
+                       break;
                if (ret < 0)
                        return FALSE;
 
@@ -72,4 +73,9 @@ int maildir_expunge_mail(struct mail_index *index,
                        return TRUE;
                }
        }
+
+       /* cur/ was updated, set it dirty-synced */
+       index->maildir_cur_dirty = ioloop_time;
+       index->file_sync_stamp = ioloop_time;
+       return TRUE;
 }
index ea91868228efd320f9f6b46d37929691d6daca5b..5893a6579cc6232e396aeba763fae92d9109cf6f 100644 (file)
@@ -1,6 +1,7 @@
 /* Copyright (C) 2002 Timo Sirainen */
 
 #include "lib.h"
+#include "ioloop.h"
 #include "maildir-index.h"
 #include "mail-index-util.h"
 
@@ -83,11 +84,21 @@ static int maildir_rename_mail(struct mail_index *index,
                        if (ret == -1)
                                return FALSE;
 
-                       if (ret == 1 && index->maildir_keep_new) {
-                               /* looks like we have some more space again,
-                                  see if we could move mails from new/ to
-                                  cur/ again */
-                               index->maildir_keep_new = FALSE;
+                       if (ret == 1) {
+                               if (index->maildir_keep_new &&
+                                   (rec->index_flags &
+                                    INDEX_MAIL_FLAG_MAILDIR_NEW) != 0) {
+                                       /* looks like we have some more space
+                                          again, see if we could move mails
+                                          from new/ to cur/ again */
+                                       index->maildir_keep_new = FALSE;
+                                       rec->index_flags &=
+                                               ~INDEX_MAIL_FLAG_MAILDIR_NEW;
+                               }
+
+                               /* cur/ was updated, set it dirty-synced */
+                                index->file_sync_stamp = ioloop_time;
+                               index->maildir_cur_dirty = ioloop_time;
                        }
 
                }