view src/imap/cmd-close.c @ 1915:79790750c349 HEAD

importing new index code. mbox still broken.
author Timo Sirainen <tss@iki.fi>
date Tue, 27 Apr 2004 23:25:52 +0300
parents 31c4bb26a1e9
children 755ec9442a58
line wrap: on
line source

/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"
#include "imap-expunge.h"

int cmd_close(struct client *client)
{
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage = mailbox_get_storage(mailbox);

	if (!client_verify_open_mailbox(client))
		return TRUE;

	client->mailbox = NULL;

	if (!mailbox_is_readonly(mailbox)) {
		if (!imap_expunge(mailbox))
			client_send_untagged_storage_error(client, storage);
	}

	if (mailbox_close(mailbox) < 0)
                client_send_untagged_storage_error(client, storage);

	client_send_tagline(client, "OK Close completed.");
	return TRUE;
}