view src/lib-index/mail-index-dummy-view.c @ 18137:3009a1a6f6d5

global: freshen copyright Robomatically: git ls-files | xargs perl -p -i -e 's/(\d+)-201[0-4]/$1-2015/g;s/ (201[0-4]) Dovecot/ $1-2015 Dovecot/' Happy 2015 everyone! Signed-off-by: Phil Carmody <phil@dovecot.fi>
author Phil Carmody <phil@dovecot.fi>
date Mon, 05 Jan 2015 22:20:10 +0200
parents add8c00fb3cc
children 0f22db71df7a
line wrap: on
line source

/* Copyright (c) 2004-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "array.h"
#include "mail-index-private.h"
#include "mail-index-view-private.h"

static void dummy_view_close(struct mail_index_view *view ATTR_UNUSED)
{
	i_assert(view->refcount == 0);

	array_free(&view->module_contexts);
	i_free(view);
}

static uint32_t
dummy_view_get_message_count(struct mail_index_view *view ATTR_UNUSED)
{
	return (uint32_t)-3;
}

static struct mail_index_view_vfuncs dummy_view_vfuncs = {
	dummy_view_close,
	dummy_view_get_message_count,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL
};

struct mail_index_view *mail_index_dummy_view_open(struct mail_index *index)
{
	struct mail_index_view *view;

	view = i_new(struct mail_index_view, 1);
	view->refcount = 1;
	view->v = dummy_view_vfuncs;
	view->index = index;
	i_array_init(&view->module_contexts,
		     I_MIN(5, mail_index_module_register.id));
	return view;
}