doveadm-mail-save.c revision e617d6e7db43c176502ac02b65d2dcb4d27103de
/* Copyright (c) 2015 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 {
struct doveadm_mail_cmd_context ctx;
const char *mailbox;
};
static int
{
struct mailbox_transaction_context *trans;
struct mail_save_context *save_ctx;
bool save_failed = FALSE;
if (mailbox_open(box) < 0) {
i_error("Failed to open mailbox %s: %s",
return -1;
}
return -1;
}
if (mailbox_save_continue(save_ctx) < 0) {
save_failed = TRUE;
ret = -1;
break;
}
}
if (input->stream_errno != 0) {
} else if (save_failed) {
} 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
{
struct mail_namespace *ns;
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;
}
static struct doveadm_mail_cmd_context *cmd_save_alloc(void)
{
struct save_cmd_context *ctx;
}
struct doveadm_mail_cmd cmd_save = {
};