[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-storage.c, 1.51, 1.52 dbox-sync-expunge.c, 1.24, 1.25 dbox-sync.c, 1.26, 1.27

tss at dovecot.org tss at dovecot.org
Tue Apr 17 15:41:34 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv21471/index/dbox

Modified Files:
	dbox-storage.c dbox-sync-expunge.c dbox-sync.c 
Log Message:
Added sync_notify() callback to struct mail_storage. It's now called for
expunges and flag/keyword changes (except with cydir).



Index: dbox-storage.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-storage.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- dbox-storage.c	11 Apr 2007 10:55:35 -0000	1.51
+++ dbox-storage.c	17 Apr 2007 12:41:27 -0000	1.52
@@ -595,6 +595,7 @@
 		dbox_storage_sync_init,
 		index_mailbox_sync_next,
 		index_mailbox_sync_deinit,
+		NULL,
 		dbox_notify_changes,
 		index_transaction_begin,
 		index_transaction_commit,

Index: dbox-sync-expunge.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync-expunge.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- dbox-sync-expunge.c	30 Mar 2007 12:44:03 -0000	1.24
+++ dbox-sync-expunge.c	17 Apr 2007 12:41:28 -0000	1.25
@@ -35,8 +35,10 @@
                   const struct dbox_sync_file_entry *sync_entry,
 		  unsigned int *sync_idx, uint32_t *uid1_r, uint32_t *uid2_r)
 {
+	struct mailbox *box = &ctx->mbox->ibox.box;
 	const struct dbox_sync_rec *sync_recs;
 	unsigned int count;
+	uint32_t uid;
 
 	sync_recs = array_get(&sync_entry->sync_recs, &count);
 
@@ -49,6 +51,15 @@
 		if (dbox_sync_rec_get_uids(ctx, &sync_recs[*sync_idx],
 					   uid1_r, uid2_r) < 0)
 			return -1;
+
+		if (box->v.sync_notify != NULL) {
+			/* all of the UIDs uid1..uid2 should exist */
+			for (uid = *uid1_r; uid <= *uid2_r; uid++) {
+				box->v.sync_notify(box, uid,
+						   MAILBOX_SYNC_TYPE_EXPUNGE);
+			}
+		}
+
 		return 1;
 	}
 

Index: dbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- dbox-sync.c	30 Mar 2007 12:44:03 -0000	1.26
+++ dbox-sync.c	17 Apr 2007 12:41:28 -0000	1.27
@@ -155,6 +155,8 @@
 		     const unsigned char *array, const unsigned char *mask)
 {
 	struct dbox_mailbox *mbox = ctx->mbox;
+	struct mailbox *box = &mbox->ibox.box;
+	enum mailbox_sync_type sync_type;
 	uint32_t file_seq, uid2;
 	uoff_t offset;
 	unsigned int i, start;
@@ -172,7 +174,27 @@
 	if ((ret = dbox_file_seek(mbox, file_seq, offset, FALSE)) <= 0)
 		return ret;
 
+	switch (sync_rec->type) {
+	case MAIL_INDEX_SYNC_TYPE_EXPUNGE:
+		sync_type = MAILBOX_SYNC_TYPE_EXPUNGE;
+		break;
+	case MAIL_INDEX_SYNC_TYPE_FLAGS:
+		sync_type = MAILBOX_SYNC_TYPE_FLAGS;
+		break;
+	case MAIL_INDEX_SYNC_TYPE_KEYWORD_ADD:
+	case MAIL_INDEX_SYNC_TYPE_KEYWORD_REMOVE:
+	case MAIL_INDEX_SYNC_TYPE_KEYWORD_RESET:
+		sync_type = MAILBOX_SYNC_TYPE_KEYWORDS;
+		break;
+	default:
+		sync_type = 0;
+		i_unreached();
+	}
 	while (mbox->file->seeked_uid <= uid2) {
+		if (box->v.sync_notify != NULL) {
+			box->v.sync_notify(box, mbox->file->seeked_uid,
+					   sync_type);
+		}
 		for (i = 0; i < flag_count; ) {
 			if (!mask[i]) {
 				i++;



More information about the dovecot-cvs mailing list