sdbox-save.c revision 2b9dbb270ad82e58d5f3581436e6f143176d5819
/* Copyright (c) 2007-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "fdatasync-path.h"
#include "hex-binary.h"
#include "hex-dec.h"
#include "str.h"
#include "istream.h"
#include "istream-crlf.h"
#include "ostream.h"
#include "write-full.h"
#include "index-mail.h"
#include "mail-copy.h"
#include "index-pop3-uidl.h"
#include "dbox-attachment.h"
#include "dbox-save.h"
#include "sdbox-storage.h"
#include "sdbox-file.h"
#include "sdbox-sync.h"
struct sdbox_save_context {
struct dbox_save_context ctx;
struct sdbox_mailbox *mbox;
struct sdbox_sync_context *sync_ctx;
struct dbox_file_append_context *append_ctx;
};
struct dbox_file *
{
struct sdbox_save_context *ctx =
(struct sdbox_save_context *)t->save_ctx;
unsigned int count;
return file;
}
struct mail_save_context *
sdbox_save_alloc(struct mailbox_transaction_context *t)
{
struct sdbox_save_context *ctx =
(struct sdbox_save_context *)t->save_ctx;
/* use the existing allocated structure */
}
return t->save_ctx;
}
{
unsigned int count;
if (ctx->first_saved_seq == 0)
if (count > 0) {
/* a plugin may leave a previously saved file open.
we'll close it here to avoid eating too many fds. */
}
}
{
int ret;
if (ret <= 0) {
return -1;
}
}
{
const struct mail_attachment_extref *extrefs;
struct dbox_message_header dbox_msg_hdr;
unsigned int i, count;
sizeof(dbox_msg_hdr),
file->file_header_size) < 0) {
return -1;
}
/* remember the attachment paths until commit time */
if (extrefs_arr != NULL)
else {
count = 0;
}
if (count > 0) {
for (i = 0; i < count; i++) {
}
}
return 0;
}
{
return -1;
/* we can't change ctime, but we can add the date to cache */
}
} T_END;
} else {
}
}
{
int ret;
return ret;
}
{
(void)sdbox_save_finish(_ctx);
}
{
struct seq_range_iter iter;
unsigned int i, count, n = 0;
bool ret;
for (i = 0; i < count; i++) {
return -1;
}
}
return 0;
}
{
unsigned int i, count;
for (i = 0; i < count; i++) {
struct sdbox_file *sfile =
(struct sdbox_file *)files[i];
(void)sdbox_file_unlink_aborted_save(sfile);
}
dbox_file_unref(&files[i]);
}
}
{
const struct mail_index_header *hdr;
/* the mail must be freed in the commit_pre() */
return 0;
}
return -1;
}
/* update dbox header flags */
/* assign UIDs for new messages */
return -1;
}
return 0;
}
{
return;
}
result);
if (fdatasync_path(box_path) < 0) {
"fdatasync_path(%s) failed: %m", box_path);
}
}
}
{
}