[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.94,
1.95 mbox-storage.h, 1.43, 1.44
tss-movial at dovecot.org
tss-movial at dovecot.org
Tue May 9 14:57:41 EEST 2006
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-save.c, 1.10,
1.11 dbox-storage.h, 1.10, 1.11
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c,
1.43, 1.44 maildir-save.c, 1.70, 1.71 maildir-storage.h, 1.49, 1.50
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv603/lib-storage/index/mbox
Modified Files:
mbox-save.c mbox-storage.h
Log Message:
Changed mailbox_save_*() API a bit: Moved the struct mail *dest_mail to
save_init() instead of being in save_finish(). This way you can request
wanted fields from the mail while it's being saved.
With maildir the message is being parsed at the same time as it's being
saved, and the results are stored into cache file.
Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- mbox-save.c 14 Apr 2006 11:14:08 -0000 1.94
+++ mbox-save.c 9 May 2006 11:57:39 -0000 1.95
@@ -344,7 +344,7 @@
enum mail_flags flags, struct mail_keywords *keywords,
time_t received_date, int timezone_offset __attr_unused__,
const char *from_envelope, struct istream *input,
- bool want_mail, struct mail_save_context **ctx_r)
+ struct mail *dest_mail, struct mail_save_context **ctx_r)
{
struct mbox_transaction_context *t =
(struct mbox_transaction_context *)_t;
@@ -372,7 +372,7 @@
ctx->failed = FALSE;
ctx->seq = 0;
- if (mbox_save_init_file(ctx, t, want_mail) < 0) {
+ if (mbox_save_init_file(ctx, t, dest_mail != NULL) < 0) {
ctx->failed = TRUE;
return -1;
}
@@ -399,10 +399,14 @@
ctx->next_uid++;
/* parse and cache the mail headers as we read it */
- 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,
+ if (dest_mail == NULL) {
+ if (ctx->mail == NULL)
+ ctx->mail = index_mail_alloc(_t, 0, NULL);
+ dest_mail = ctx->mail;
+ }
+ if (mail_set_seq(dest_mail, ctx->seq) < 0)
+ i_unreached();
+ index_mail_parse_header_init((struct index_mail *)dest_mail,
NULL);
}
mbox_save_append_flag_headers(ctx->headers, save_flags);
@@ -516,7 +520,7 @@
return ctx->input->eof && size == 0 ? 0 : mbox_save_continue(_ctx);
}
-int mbox_save_finish(struct mail_save_context *_ctx, struct mail *dest_mail)
+int mbox_save_finish(struct mail_save_context *_ctx)
{
struct mbox_save_context *ctx = (struct mbox_save_context *)_ctx;
@@ -539,17 +543,7 @@
ctx->mail_offset = (uoff_t)-1;
}
- if (ctx->failed)
- return -1;
-
- if (dest_mail != NULL) {
- i_assert(ctx->seq != 0);
-
- if (mail_set_seq(dest_mail, ctx->seq) < 0)
- return -1;
- }
-
- return 0;
+ return ctx->failed ? -1 : 0;
}
void mbox_save_cancel(struct mail_save_context *_ctx)
@@ -557,7 +551,7 @@
struct mbox_save_context *ctx = (struct mbox_save_context *)_ctx;
ctx->failed = TRUE;
- (void)mbox_save_finish(_ctx, NULL);
+ (void)mbox_save_finish(_ctx);
}
static void mbox_transaction_save_deinit(struct mbox_save_context *ctx)
Index: mbox-storage.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-storage.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- mbox-storage.h 9 Apr 2006 15:50:29 -0000 1.43
+++ mbox-storage.h 9 May 2006 11:57:39 -0000 1.44
@@ -84,9 +84,9 @@
enum mail_flags flags, struct mail_keywords *keywords,
time_t received_date, int timezone_offset,
const char *from_envelope, struct istream *input,
- bool want_mail, struct mail_save_context **ctx_r);
+ struct mail *dest_mail, struct mail_save_context **ctx_r);
int mbox_save_continue(struct mail_save_context *ctx);
-int mbox_save_finish(struct mail_save_context *ctx, struct mail *dest_mail);
+int mbox_save_finish(struct mail_save_context *ctx);
void mbox_save_cancel(struct mail_save_context *ctx);
int mbox_transaction_save_commit(struct mbox_save_context *ctx);
- Previous message: [dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-save.c, 1.10,
1.11 dbox-storage.h, 1.10, 1.11
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-copy.c,
1.43, 1.44 maildir-save.c, 1.70, 1.71 maildir-storage.h, 1.49, 1.50
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list