dovecot-2.0: Reverted changes committed accidentally in previous...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jul 9 20:30:27 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/a032deb40060
changeset: 9599:a032deb40060
user: Timo Sirainen <tss at iki.fi>
date: Thu Jul 09 13:30:22 2009 -0400
description:
Reverted changes committed accidentally in previous commit.
diffstat:
2 files changed, 35 insertions(+), 25 deletions(-)
src/lib-storage/index/maildir/maildir-copy.c | 16 +++++++--
src/lib-storage/index/maildir/maildir-save.c | 44 +++++++++++++-------------
diffs (149 lines):
diff -r 444ce507a5ea -r a032deb40060 src/lib-storage/index/maildir/maildir-copy.c
--- a/src/lib-storage/index/maildir/maildir-copy.c Thu Jul 09 13:28:30 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-copy.c Thu Jul 09 13:30:22 2009 -0400
@@ -125,7 +125,9 @@ static int do_hardlink(struct maildir_ma
}
static int
-maildir_copy_hardlink(struct maildir_transaction_context *t, struct mail *mail)
+maildir_copy_hardlink(struct maildir_transaction_context *t, struct mail *mail,
+ enum mail_flags flags, struct mail_keywords *keywords,
+ struct mail *dest_mail)
{
struct maildir_mailbox *dest_mbox =
(struct maildir_mailbox *)t->ictx.ibox;
@@ -147,6 +149,11 @@ maildir_copy_hardlink(struct maildir_tra
if (t->save_ctx == NULL)
t->save_ctx = maildir_save_transaction_init(t);
+
+ /* don't allow caller to specify recent flag */
+ flags &= ~MAIL_RECENT;
+ if (dest_mbox->ibox.keep_recent)
+ flags |= MAIL_RECENT;
memset(&do_ctx, 0, sizeof(do_ctx));
do_ctx.dest_path = str_new(default_pool, 512);
@@ -202,7 +209,8 @@ maildir_copy_hardlink(struct maildir_tra
}
/* hardlinked to tmp/, treat as normal copied mail */
- maildir_save_add(t->save_ctx, do_ctx.dest_fname);
+ maildir_save_add(t->save_ctx, do_ctx.dest_fname, flags, keywords,
+ dest_mail);
return 1;
}
@@ -223,7 +231,9 @@ int maildir_copy(struct mail_save_contex
if (mbox->storage->set->maildir_copy_with_hardlinks &&
maildir_compatible_file_modes(&mbox->ibox.box, mail->box)) {
T_BEGIN {
- ret = maildir_copy_hardlink(t, mail);
+ ret = maildir_copy_hardlink(t, mail, ctx->flags,
+ ctx->keywords,
+ ctx->dest_mail);
} T_END;
if (ret != 0) {
diff -r 444ce507a5ea -r a032deb40060 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c Thu Jul 09 13:28:30 2009 -0400
+++ b/src/lib-storage/index/maildir/maildir-save.c Thu Jul 09 13:30:22 2009 -0400
@@ -135,25 +135,22 @@ maildir_save_transaction_init(struct mai
}
uint32_t maildir_save_add(struct maildir_save_context *ctx,
- const char *base_fname)
+ const char *base_fname, enum mail_flags flags,
+ struct mail_keywords *keywords,
+ struct mail *dest_mail)
{
struct maildir_filename *mf;
struct istream *input;
-
- /* don't allow caller to specify recent flag */
- ctx->ctx.flags &= ~MAIL_RECENT;
- if (dest_mbox->ibox.keep_recent)
- ctx->ctx.flags |= MAIL_RECENT;
/* now, we want to be able to rollback the whole append session,
so we'll just store the name of this temp file and move it later
into new/ or cur/. */
/* @UNSAFE */
mf = p_malloc(ctx->pool, sizeof(*mf) +
- sizeof(unsigned int) * (ctx->ctx.keywords == NULL ? 0 :
- ctx->ctx.keywords->count));
+ sizeof(unsigned int) * (keywords == NULL ? 0 :
+ keywords->count));
mf->basename = p_strdup(ctx->pool, base_fname);
- mf->flags = ctx->ctx.flags;
+ mf->flags = flags;
mf->size = (uoff_t)-1;
mf->vsize = (uoff_t)-1;
@@ -163,24 +160,22 @@ uint32_t maildir_save_add(struct maildir
ctx->files_tail = &mf->next;
ctx->files_count++;
- if (ctx->ctx.keywords != NULL) {
- i_assert(sizeof(ctx->ctx.keywords->idx[0]) ==
- sizeof(unsigned int));
+ if (keywords != NULL) {
+ i_assert(sizeof(keywords->idx[0]) == sizeof(unsigned int));
/* @UNSAFE */
- mf->keywords_count = ctx->ctx.keywords->count;
- memcpy(mf + 1, ctx->ctx.keywords->idx,
- sizeof(unsigned int) * ctx->ctx.keywords->count);
+ mf->keywords_count = keywords->count;
+ memcpy(mf + 1, keywords->idx,
+ sizeof(unsigned int) * keywords->count);
ctx->have_keywords = TRUE;
}
/* insert into index */
mail_index_append(ctx->trans, 0, &ctx->seq);
- mail_index_update_flags(ctx->trans, ctx->seq,
- MODIFY_REPLACE, ctx->ctx.flags);
- if (ctx->ctx.keywords != NULL) {
+ mail_index_update_flags(ctx->trans, ctx->seq, MODIFY_REPLACE, flags);
+ if (keywords != NULL) {
mail_index_update_keywords(ctx->trans, ctx->seq,
- MODIFY_REPLACE, ctx->ctx.keywords);
+ MODIFY_REPLACE, keywords);
}
if (ctx->first_seq == 0) {
@@ -188,10 +183,10 @@ uint32_t maildir_save_add(struct maildir
i_assert(ctx->files->next == NULL);
}
- if (ctx->ctx.dest_mail == NULL) {
+ if (dest_mail == NULL) {
if (ctx->mail == NULL)
ctx->mail = mail_alloc(ctx->ctx.transaction, 0, NULL);
- ctx->ctx.dest_mail = ctx->mail;
+ dest_mail = ctx->mail;
}
mail_set_seq(dest_mail, ctx->seq);
@@ -376,6 +371,10 @@ int maildir_save_begin(struct mail_save_
(struct maildir_transaction_context *)_ctx->transaction;
struct maildir_save_context *ctx = (struct maildir_save_context *)_ctx;
+ _ctx->flags &= ~MAIL_RECENT;
+ if (ctx->mbox->ibox.keep_recent)
+ _ctx->flags |= MAIL_RECENT;
+
T_BEGIN {
/* create a new file in tmp/ directory */
const char *fname = _ctx->guid;
@@ -388,7 +387,8 @@ int maildir_save_begin(struct mail_save_
ctx->input = i_stream_create_crlf(input);
else
ctx->input = i_stream_create_lf(input);
- maildir_save_add(ctx, fname);
+ maildir_save_add(t->save_ctx, fname, _ctx->flags,
+ _ctx->keywords, _ctx->dest_mail);
}
} T_END;
More information about the dovecot-cvs
mailing list