[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-storage.c, 1.79, 1.80 maildir-storage.h, 1.24, 1.25 maildir-sync.c, 1.35, 1.36

cras at dovecot.org cras at dovecot.org
Mon Jul 12 14:35:53 EEST 2004


Update of /home/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv2470/lib-storage/index/maildir

Modified Files:
	maildir-storage.c maildir-storage.h maildir-sync.c 
Log Message:
Broke mailbox_sync() into iterator.



Index: maildir-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- maildir-storage.c	11 Jul 2004 21:04:46 -0000	1.79
+++ maildir-storage.c	12 Jul 2004 11:35:51 -0000	1.80
@@ -798,22 +798,17 @@
 	return ret;
 }
 
-static void maildir_storage_auto_sync(struct mailbox *box,
-				      enum mailbox_sync_flags flags,
-				      unsigned int min_newmail_notify_interval)
+static void
+maildir_notify_changes(struct mailbox *box, unsigned int min_interval,
+		       mailbox_notify_callback_t *callback, void *context)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *)box;
 
-	ibox->min_newmail_notify_interval = min_newmail_notify_interval;
-
-	if ((ibox->autosync_flags == 0 && flags == 0) ||
-	    (ibox->autosync_flags != 0 && flags != 0)) {
-		/* flags or interval just changed. or nothing. */
-		ibox->autosync_flags = flags;
-	}
-	ibox->autosync_flags = flags;
+	ibox->min_notify_interval = min_interval;
+	ibox->notify_callback = callback;
+	ibox->notify_context = context;
 
-	if (flags == 0) {
+	if (callback == NULL) {
 		index_mailbox_check_remove_all(ibox);
 		return;
 	}
@@ -857,8 +852,10 @@
         index_storage_allow_new_keywords,
 	maildir_storage_close,
 	index_storage_get_status,
-	maildir_storage_sync,
-	maildir_storage_auto_sync,
+	maildir_storage_sync_init,
+	index_mailbox_sync_next,
+	index_mailbox_sync_deinit,
+	maildir_notify_changes,
 	maildir_transaction_begin,
 	maildir_transaction_commit,
 	maildir_transaction_rollback,

Index: maildir-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-storage.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- maildir-storage.h	20 Jun 2004 03:25:33 -0000	1.24
+++ maildir-storage.h	12 Jul 2004 11:35:51 -0000	1.25
@@ -38,7 +38,8 @@
 struct mailbox_list *
 maildir_mailbox_list_next(struct mailbox_list_context *ctx);
 
-int maildir_storage_sync(struct mailbox *box, enum mailbox_sync_flags flags);
+struct mailbox_sync_context *
+maildir_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);
 int maildir_storage_sync_force(struct index_mailbox *ibox);
 
 struct mailbox_transaction_context *

Index: maildir-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- maildir-sync.c	12 Jul 2004 08:07:03 -0000	1.35
+++ maildir-sync.c	12 Jul 2004 11:35:51 -0000	1.36
@@ -913,11 +913,12 @@
 	return ret;
 }
 
-int maildir_storage_sync(struct mailbox *box, enum mailbox_sync_flags flags)
+struct mailbox_sync_context *
+maildir_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *)box;
 	struct maildir_sync_context *ctx;
-	int ret;
+	int ret = 0;
 
 	if ((flags & MAILBOX_SYNC_FLAG_FAST) == 0 ||
 	    ibox->sync_last_check + MAILBOX_FULL_SYNC_INTERVAL <= ioloop_time) {
@@ -926,10 +927,7 @@
 		ctx = maildir_sync_context_new(ibox);
 		ret = maildir_sync_context(ctx, FALSE);
 		maildir_sync_deinit(ctx);
-
-		if (ret < 0)
-			return -1;
 	}
 
-	return index_storage_sync(box, flags);
+	return index_mailbox_sync_init(box, flags, ret < 0);
 }



More information about the dovecot-cvs mailing list