mail-index-sync-update.c revision 2d79e603e20a32bdae4c2b516ead5c5c9169545a
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Copyright (C) 2004 Timo Sirainen */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid mail_index_sync_replace_map(struct mail_index_sync_map_ctx *ctx,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* if map still exists after this, it's only in views. */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* keywords aren't parsed for the new map yet */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if ((ctx->type & (MAIL_INDEX_SYNC_HANDLER_FILE |
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen mail_index_unmap(view->index, &view->index->map);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (ctx->type == MAIL_INDEX_SYNC_HANDLER_FILE) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen i_assert(view->hdr.messages_count == map->hdr.messages_count);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenmail_index_header_update_counts(struct mail_index_header *hdr,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char **error_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (((old_flags ^ new_flags) & MAIL_RECENT) != 0) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* different recent-flag */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (hdr->recent_messages_count > hdr->messages_count) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen hdr->recent_messages_count > hdr->messages_count) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen hdr->first_recent_uid_lowwater = hdr->next_uid;
4aab01f4eade3d278b61471516c062ce30a84b5fTimo Sirainen if (((old_flags ^ new_flags) & MAIL_SEEN) != 0) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* different seen-flag */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (hdr->seen_messages_count >= hdr->messages_count) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (++hdr->seen_messages_count == hdr->messages_count)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen hdr->first_unseen_uid_lowwater = hdr->next_uid;
const char *error;
&error) < 0)
const char *error;
unsigned int i, expunge_handlers_count;
if (seq1 == 0)
&error) < 0) {
for (i = 0; i < expunge_handlers_count; i++) {
const char *error;
void *dest;
&error) < 0) {
const char *error;
if (seq1 == 0)
&error) < 0) {
unsigned int count)
void *hdr_copy;
t_push();
t_pop();
t_pop();
const int max_days =
int i, days;
const void *data)
int ret = 0;
t_push();
case MAIL_TRANSACTION_APPEND: {
if (ret <= 0)
case MAIL_TRANSACTION_EXPUNGE:
if (ret <= 0)
case MAIL_TRANSACTION_FLAG_UPDATE: {
if (ret <= 0)
case MAIL_TRANSACTION_HEADER_UPDATE: {
if (ret <= 0)
case MAIL_TRANSACTION_EXT_INTRO: {
if (ret <= 0)
case MAIL_TRANSACTION_EXT_RESET: {
case MAIL_TRANSACTION_EXT_HDR_UPDATE: {
if (ret <= 0)
case MAIL_TRANSACTION_EXT_REC_UPDATE: {
unsigned int record_size;
if (ret <= 0)
case MAIL_TRANSACTION_KEYWORD_UPDATE: {
case MAIL_TRANSACTION_KEYWORD_RESET: {
i_unreached();
t_pop();
return ret;
bool sync_only_external)
const void *data;
int ret;
if (had_dirty)
first_append_uid = 0;
if (sync_only_external) {
} else if (check_ext_offsets) {
if (first_append_uid == 0)
if (ret < 0) {
if (!sync_only_external)
if (first_append_uid != 0)
had_dirty) {
unsigned int base_size;
return ret;