Mercurial > dovecot > original-hg > dovecot-1.2
diff src/lib-index/mail-index-sync.c @ 1956:d6941cd8afdc HEAD
Added support for setting dirty flags for messages (TODO: undirty..)
s/mail_index_record_flag/mail_cache_record_flag/
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 02 May 2004 22:24:35 +0300 |
parents | 2f6e137cdc44 |
children | d77a2a1e9278 |
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync.c Sun May 02 21:42:28 2004 +0300 +++ b/src/lib-index/mail-index-sync.c Sun May 02 22:24:35 2004 +0300 @@ -397,6 +397,20 @@ ctx->sync_appends; } +int mail_index_sync_set_dirty(struct mail_index_sync_ctx *ctx, uint32_t seq) +{ + if (ctx->dirty_lock_id == 0) { + if (mail_index_lock_exclusive(ctx->index, + &ctx->dirty_lock_id) < 0) + return -1; + } + + i_assert(seq <= ctx->view->map->records_count); + ctx->view->map->records[seq-1].flags |= MAIL_INDEX_MAIL_FLAG_DIRTY; + ctx->have_dirty = TRUE; + return 0; +} + int mail_index_sync_end(struct mail_index_sync_ctx *ctx, uint32_t sync_stamp, uint64_t sync_size) { @@ -421,11 +435,15 @@ if (ret == 0) { mail_index_sync_read_and_sort(ctx, TRUE); + if (mail_index_sync_update_index(ctx, sync_stamp, sync_size) < 0) ret = -1; } + if (ctx->dirty_lock_id == 0) + mail_index_unlock(ctx->index, ctx->dirty_lock_id); + mail_index_unlock(ctx->index, ctx->lock_id); mail_transaction_log_sync_unlock(ctx->index->log); mail_index_view_close(ctx->view);