[dovecot-cvs] dovecot/src/lib-index mail-index-sync.c, 1.55, 1.56 mail-index.h, 1.146, 1.147

cras at dovecot.org cras at dovecot.org
Fri Apr 8 01:22:20 EEST 2005


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv584/lib-index

Modified Files:
	mail-index-sync.c mail-index.h 
Log Message:
Added mail_index_sync_reset() to restart syncing from beginning.



Index: mail-index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- mail-index-sync.c	2 Apr 2005 21:09:03 -0000	1.55
+++ mail-index-sync.c	7 Apr 2005 22:22:18 -0000	1.56
@@ -498,7 +498,7 @@
 	/* FIXME: replace with a priority queue so we don't have to go
 	   through the whole list constantly. and remember to make sure that
 	   keyword resets are sent before adds! */
-	sync_list = array_get(&ctx->sync_list, &count);
+	sync_list = array_get_modifyable(&ctx->sync_list, &count);
 	for (i = 0; i < count; i++) {
 		if (!array_is_created(sync_list[i].array) ||
 		    sync_list[i].idx == array_count(sync_list[i].array))
@@ -568,6 +568,18 @@
 	return FALSE;
 }
 
+void mail_index_sync_reset(struct mail_index_sync_ctx *ctx)
+{
+	struct mail_index_sync_list *sync_list;
+	unsigned int i, count;
+
+	ctx->next_uid = 0;
+
+	sync_list = array_get_modifyable(&ctx->sync_list, &count);
+	for (i = 0; i < count; i++)
+		sync_list[i].idx = 0;
+}
+
 static void mail_index_sync_end(struct mail_index_sync_ctx *ctx)
 {
 	mail_index_unlock(ctx->index, ctx->lock_id);

Index: mail-index.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.h,v
retrieving revision 1.146
retrieving revision 1.147
diff -u -d -r1.146 -r1.147
--- mail-index.h	2 Apr 2005 21:09:05 -0000	1.146
+++ mail-index.h	7 Apr 2005 22:22:18 -0000	1.147
@@ -225,6 +225,9 @@
 			 struct mail_index_sync_rec *sync_rec);
 /* Returns 1 if there's more to sync, 0 if not. */
 int mail_index_sync_have_more(struct mail_index_sync_ctx *ctx);
+/* Reset syncing to initial state after mail_index_sync_begin(), so you can
+   go through all the sync records again with mail_index_sync_next(). */
+void mail_index_sync_reset(struct mail_index_sync_ctx *ctx);
 /* Commit synchronization by writing all changes to mail index file. */
 int mail_index_sync_commit(struct mail_index_sync_ctx *ctx);
 /* Rollback synchronization - none of the changes listed by sync_next() are



More information about the dovecot-cvs mailing list