[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.83,
1.84
cras at dovecot.org
cras at dovecot.org
Sun Jul 3 18:42:18 EEST 2005
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv3248/lib-storage/index/mbox
Modified Files:
mbox-save.c
Log Message:
Cache mail headers when saving mails to mbox. We should cache everything,
but this is a start..
Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- mbox-save.c 29 Apr 2005 10:13:04 -0000 1.83
+++ mbox-save.c 3 Jul 2005 15:42:16 -0000 1.84
@@ -10,6 +10,7 @@
#include "istream-header-filter.h"
#include "ostream-crlf.h"
#include "message-parser.h"
+#include "index-mail.h"
#include "mbox-storage.h"
#include "mbox-file.h"
#include "mbox-from.h"
@@ -29,6 +30,7 @@
struct mbox_mailbox *mbox;
struct mail_index_transaction *trans;
+ struct mail *mail;
uoff_t append_offset, mail_offset;
string_t *headers;
@@ -320,6 +322,11 @@
if ((hdr == NULL && ctx->eoh_input_offset == (uoff_t)-1) ||
(hdr != NULL && hdr->eoh))
ctx->eoh_input_offset = ctx->input->v_offset;
+
+ if (ctx->mail != NULL) {
+ index_mail_parse_header(NULL, hdr,
+ (struct index_mail *)ctx->mail);
+ }
}
struct mail_save_context *
@@ -376,6 +383,12 @@
mail_index_update_ext(ctx->trans, ctx->seq,
mbox->mbox_ext_idx, &offset, NULL);
ctx->next_uid++;
+
+ if (ctx->mail == NULL)
+ ctx->mail = index_mail_alloc(_t, 0, NULL);
+ mail_set_seq(ctx->mail, ctx->seq);
+ index_mail_parse_header_init((struct index_mail *)ctx->mail,
+ NULL);
}
mbox_save_append_flag_headers(ctx->headers, save_flags);
mbox_save_append_keyword_headers(ctx, keywords);
@@ -540,6 +553,8 @@
if (ctx->output != NULL)
o_stream_unref(ctx->output);
+ if (ctx->mail != NULL)
+ index_mail_free(ctx->mail);
str_free(ctx->headers);
i_free(ctx);
}
More information about the dovecot-cvs
mailing list