Mercurial > dovecot > core-2.2
changeset 3264:98e3001ca527 HEAD
Added mail_index_sync_reset() to restart syncing from beginning.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 08 Apr 2005 01:22:18 +0300 |
parents | fb34cde02ac8 |
children | cb62447e3e75 |
files | src/lib-index/mail-index-sync.c src/lib-index/mail-index.h |
diffstat | 2 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync.c Fri Apr 08 01:09:07 2005 +0300 +++ b/src/lib-index/mail-index-sync.c Fri Apr 08 01:22:18 2005 +0300 @@ -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);
--- a/src/lib-index/mail-index.h Fri Apr 08 01:09:07 2005 +0300 +++ b/src/lib-index/mail-index.h Fri Apr 08 01:22:18 2005 +0300 @@ -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