-I$(top_srcdir)/src/lib-imap
libstorage_a_SOURCES = \
+ mail-save.c \
mail-search.c \
mail-storage.c
noinst_HEADERS = \
+ mail-save.h \
mail-search.h \
mail-storage.h
index-mail.c \
index-mailbox-check.c \
index-messageset.c \
- index-save.c \
index-search.c \
index-status.c \
index-storage.c \
#include "mail-index.h"
#include "index-mail.h"
-typedef int write_func_t(struct ostream *, const void *, size_t);
-
-/* Return -1 = failure, 0 = don't write the header, 1 = write it */
-typedef int header_callback_t(const char *name,
- write_func_t *write_func, void *context);
-
struct index_autosync_file {
struct index_autosync_file *next;
struct mail_index_record *rec,
unsigned int seq, int notify);
-int index_storage_save(struct mail_storage *storage, const char *path,
- struct istream *input, struct ostream *output,
- header_callback_t *header_callback, void *context);
-
void index_mailbox_check_add(struct index_mailbox *ibox, const char *path);
void index_mailbox_check_remove_all(struct index_mailbox *ibox);
#include "ostream.h"
#include "maildir-index.h"
#include "maildir-storage.h"
+#include "mail-save.h"
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <utime.h>
IO_PRIORITY_DEFAULT, FALSE);
o_stream_set_blocking(output, 60000, NULL, NULL);
- if (!index_storage_save(ibox->box.storage, path, input, output,
- NULL, NULL))
+ if (!mail_storage_save(ibox->box.storage, path, input, output,
+ getenv("MAIL_SAVE_CRLF") != NULL, NULL, NULL))
fname = NULL;
o_stream_unref(output);
#include "mbox-index.h"
#include "mbox-lock.h"
#include "mbox-storage.h"
+#include "mail-save.h"
#include <stdlib.h>
#include <unistd.h>
t_push();
if (!write_from_line(ctx, received_date) ||
- !index_storage_save(ctx->ibox->box.storage,
- ctx->ibox->index->mailbox_path,
- data, ctx->output, save_header_callback, ctx) ||
+ !mail_storage_save(ctx->ibox->box.storage,
+ ctx->ibox->index->mailbox_path,
+ data, ctx->output,
+ getenv("MAIL_SAVE_CRLF") != NULL,
+ save_header_callback, ctx) ||
!mbox_fix_header(ctx) ||
!mbox_append_lf(ctx)) {
/* failed, truncate file back to original size.
#include "lib.h"
#include "istream.h"
#include "ostream.h"
-#include "write-full.h"
-#include "index-storage.h"
-
-#include <stdlib.h>
-#include <unistd.h>
+#include "message-parser.h"
+#include "mail-storage.h"
+#include "mail-save.h"
static int write_with_crlf(struct ostream *output, const void *v_data,
size_t size)
return !failed;
}
-int index_storage_save(struct mail_storage *storage, const char *path,
- struct istream *input, struct ostream *output,
- header_callback_t *header_callback, void *context)
+int mail_storage_save(struct mail_storage *storage, const char *path,
+ struct istream *input, struct ostream *output, int crlf,
+ header_callback_t *header_callback, void *context)
{
write_func_t *write_func;
const unsigned char *data;
ssize_t ret;
int failed;
- write_func = getenv("MAIL_SAVE_CRLF") ? write_with_crlf : write_with_lf;
+ write_func = crlf ? write_with_crlf : write_with_lf;
if (header_callback != NULL) {
if (!save_headers(input, output, header_callback,
--- /dev/null
+#ifndef __MAIL_SAVE_H
+#define __MAIL_SAVE_H
+
+typedef int write_func_t(struct ostream *, const void *, size_t);
+
+/* Return -1 = failure, 0 = don't write the header, 1 = write it */
+typedef int header_callback_t(const char *name,
+ write_func_t *write_func, void *context);
+
+int mail_storage_save(struct mail_storage *storage, const char *path,
+ struct istream *input, struct ostream *output, int crlf,
+ header_callback_t *header_callback, void *context);
+
+#endif