imapc-save.c revision 4bb24a20bb017b6e3301d6a8e961a08aa71cf10f
/* Copyright (c) 2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "istream.h"
#include "istream-crlf.h"
#include "ostream.h"
#include "imap-date.h"
#include "imap-util.h"
#include "index-mail.h"
#include "mail-copy.h"
#include "imapc-client.h"
#include "imapc-storage.h"
#include "imapc-sync.h"
struct imapc_save_context {
struct mail_save_context ctx;
struct imapc_mailbox *mbox;
struct mail_index_transaction *trans;
int fd;
char *temp_path;
unsigned int failed:1;
unsigned int finished:1;
};
struct imapc_save_cmd_context {
struct imapc_save_context *ctx;
int ret;
};
struct mail_save_context *
imapc_save_alloc(struct mailbox_transaction_context *t)
{
struct imapc_save_context *ctx;
}
return t->save_ctx;
}
{
const char *path;
"Couldn't create temp file %s", path);
return -1;
}
/* we may not know the size of the input, or be sure that it contains
only CRLFs. so we'll always first write the mail to a temp file and
upload it from there to remote server. */
return 0;
}
{
return -1;
if (!mail_storage_set_error_from_errno(storage)) {
"o_stream_send_istream(%s) failed: %m",
}
return -1;
}
return 0;
}
const struct imapc_command_reply *reply)
{
const char *const *args;
/* <uidvalidity> <dest uid-set> */
return;
return;
if (ctx->dest_uid_validity == 0)
return;
}
void *context)
{
} else {
}
}
static void
{
const char *const *kw_p;
unsigned int i;
}
}
{
struct imapc_save_cmd_context sctx;
}
}
}
{
if (!mail_storage_set_error_from_errno(storage)) {
"o_stream_flush(%s) failed: %m",
}
}
}
if (imapc_save_append(ctx) < 0)
}
}
}
{
(void)imapc_save_finish(_ctx);
}
{
struct mail_transaction_commit_changes *changes =
}
return 0;
}
{
}
{
/* FIXME: if we really want to rollback, we should expunge messages
we already saved */
}
const struct imapc_command_reply *reply)
{
const char *const *args;
/* <uidvalidity> <source uid-set> <dest uid-set> */
return;
return;
if (ctx->dest_uid_validity == 0)
return;
}
void *context)
{
} else {
}
}
{
struct imapc_save_cmd_context sctx;
/* same server, we can use COPY for the mail */
"UID COPY %u %s",
}
}