/* Copyright (c) 2015-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream.h"
#include "mail-storage.h"
#include "doveadm-mail.h"
struct save_cmd_context {
const char *mailbox;
};
static int
{
if (input->stream_errno != 0) {
i_error("open(%s) failed: %s",
return -1;
}
if (mailbox_open(box) < 0) {
i_error("Failed to open mailbox %s: %s",
return -1;
}
__func__);
i_error("Saving failed: %s",
return -1;
}
do {
if (mailbox_save_continue(save_ctx) < 0) {
save_failed = TRUE;
ret = -1;
break;
}
if (input->stream_errno != 0) {
} else if (save_failed) {
i_error("Saving failed: %s",
} else if (mailbox_save_finish(&save_ctx) < 0) {
i_error("Saving failed: %s",
} else if (mailbox_transaction_commit(&trans) < 0) {
i_error("Save transaction commit failed: %s",
} else {
ret = 0;
}
return ret < 0 ? -1 : 0;
}
static int
{
int ret;
mailbox_free(&box);
return ret;
}
const char *const args[] ATTR_UNUSED)
{
}
static bool
{
switch (c) {
case 'm':
break;
default:
return FALSE;
}
return TRUE;
}
{
}
.name = "save",
};