view src/lib-index/maildir/maildir-update.c @ 903:fd8888f6f037 HEAD

Naming style changes, finally got tired of most of the typedefs. Also the previous enum -> macro change reverted so that we don't use the highest bit anymore, that's incompatible with old indexes so they will be rebuilt.
author Timo Sirainen <tss@iki.fi>
date Sun, 05 Jan 2003 15:09:51 +0200
parents f57c52738f90
children
line wrap: on
line source

/* Copyright (C) 2002 Timo Sirainen */

#include "lib.h"
#include "istream.h"
#include "maildir-index.h"

int maildir_record_update(struct mail_index *index,
			  struct mail_index_update *update, int fd)
{
	struct istream *input;
        enum mail_data_field cache_fields;

	/* don't even bother opening the file if we're not going to do
	   anything */
	cache_fields = index->header->cache_fields & ~DATA_FIELD_LOCATION;
	if (cache_fields == 0)
		return TRUE;

	t_push();
	if (index->mail_read_mmaped) {
		input = i_stream_create_mmap(fd, data_stack_pool,
					     MAIL_MMAP_BLOCK_SIZE, 0, 0, FALSE);
	} else {
		input = i_stream_create_file(fd, data_stack_pool,
					     MAIL_READ_BLOCK_SIZE, FALSE);
	}
	mail_index_update_headers(update, input, cache_fields, NULL, NULL);
	i_stream_unref(input);
	t_pop();
	return TRUE;
}