[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-storage.c, 1.86, 1.87 mbox-storage.h, 1.24, 1.25 mbox-sync.c, 1.58, 1.59

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/mbox
In directory talvi:/tmp/cvs-serv2470/lib-storage/index/mbox

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



Index: mbox-storage.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -d -r1.86 -r1.87
--- mbox-storage.c	11 Jul 2004 21:04:47 -0000	1.86
+++ mbox-storage.c	12 Jul 2004 11:35:51 -0000	1.87
@@ -831,22 +831,17 @@
 	return 0;
 }
 
-static void mbox_storage_auto_sync(struct mailbox *box,
-				   enum mailbox_sync_flags flags,
-				   unsigned int min_newmail_notify_interval)
+static void
+mbox_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);
 	else
 		index_mailbox_check_add(ibox, ibox->path, FALSE);
@@ -885,8 +880,10 @@
         index_storage_allow_new_keywords,
 	mbox_storage_close,
 	index_storage_get_status,
-	mbox_storage_sync,
-	mbox_storage_auto_sync,
+	mbox_storage_sync_init,
+	index_mailbox_sync_next,
+	index_mailbox_sync_deinit,
+	mbox_notify_changes,
 	mbox_transaction_begin,
 	mbox_transaction_commit,
 	mbox_transaction_rollback,

Index: mbox-storage.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- mbox-storage.h	3 Jul 2004 18:13:45 -0000	1.24
+++ mbox-storage.h	12 Jul 2004 11:35:51 -0000	1.25
@@ -34,7 +34,8 @@
 int mbox_transaction_commit(struct mailbox_transaction_context *t);
 void mbox_transaction_rollback(struct mailbox_transaction_context *t);
 
-int mbox_storage_sync(struct mailbox *box, enum mailbox_sync_flags flags);
+struct mailbox_sync_context *
+mbox_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags);
 
 int mbox_save(struct mailbox_transaction_context *t,
 	      const struct mail_full_flags *flags,

Index: mbox-sync.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- mbox-sync.c	11 Jul 2004 22:45:29 -0000	1.58
+++ mbox-sync.c	12 Jul 2004 11:35:51 -0000	1.59
@@ -1320,17 +1320,18 @@
 	return ret;
 }
 
-int mbox_storage_sync(struct mailbox *box, enum mailbox_sync_flags flags)
+struct mailbox_sync_context *
+mbox_storage_sync_init(struct mailbox *box, enum mailbox_sync_flags flags)
 {
 	struct index_mailbox *ibox = (struct index_mailbox *)box;
+	int ret = 0;
 
 	if ((flags & MAILBOX_SYNC_FLAG_FAST) == 0 ||
 	    ibox->sync_last_check + MAILBOX_FULL_SYNC_INTERVAL <= ioloop_time) {
 		ibox->sync_last_check = ioloop_time;
 
-		if (mbox_sync(ibox, FALSE, FALSE, FALSE) < 0)
-			return -1;
+		ret = mbox_sync(ibox, FALSE, FALSE, FALSE);
 	}
 
-	return index_storage_sync(box, flags);
+	return index_mailbox_sync_init(box, flags, ret < 0);
 }



More information about the dovecot-cvs mailing list