/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"

int cmd_logout(struct client *client)
{
	client_send_line(client, "* BYE Logging out");

	if (client->mailbox != NULL) {
		/* this could be done at client_disconnect() as well,
		   but eg. mbox rewrite takes a while so the waiting is
		   better to happen before "OK" message. */
		mailbox_close(client->mailbox);
		client->mailbox = NULL;
	}

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

/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"

int cmd_logout(struct client *client)
{
	client_send_line(client, "* BYE Logging out");
	o_stream_uncork(client->output);

	if (client->mailbox != NULL) {
		/* this could be done at client_disconnect() as well,
		   but eg. mbox rewrite takes a while so the waiting is
		   better to happen before "OK" message. */
		mailbox_close(client->mailbox);
		client->mailbox = NULL;
	}

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

Send the "* BYE Logging out" before closing mailbox.
Send the "* BYE Logging out" before closing mailbox.
